From ab0985971f429de926d0600e228d5aa0125cbdbd Mon Sep 17 00:00:00 2001 From: Don Armstrong Date: Thu, 22 Sep 2011 21:30:47 +0000 Subject: [PATCH] upgrade to 1.26; fix lintian issues --- Changes | 4 ++ LICENSE | 28 ++++----- MANIFEST | 2 + META.json | 11 ++-- Makefile.PL | 59 ++++++++++--------- bs.pm | 23 ++++++++ debian/changelog | 6 ++ debian/control | 2 +- debian/rules | 3 + debian/source/format | 1 + dist.ini | 5 +- lib/HTML/CalendarMonth.pm | 39 +++++++------ lib/HTML/CalendarMonth/DateTool.pm | 11 +++- lib/HTML/CalendarMonth/DateTool/Cal.pm | 4 +- lib/HTML/CalendarMonth/DateTool/DateCalc.pm | 4 +- lib/HTML/CalendarMonth/DateTool/DateManip.pm | 4 +- lib/HTML/CalendarMonth/DateTool/DateTime.pm | 4 +- lib/HTML/CalendarMonth/DateTool/Ncal.pm | 4 +- lib/HTML/CalendarMonth/DateTool/TimeLocal.pm | 4 +- lib/HTML/CalendarMonth/Locale.pm | 4 +- t/author-critic.t | 1 + t/dat/head.dat | 16 ++++++ t/testload.pm | 60 +++++++++++++++----- 23 files changed, 198 insertions(+), 101 deletions(-) create mode 100644 bs.pm create mode 100644 debian/source/format create mode 100644 t/dat/head.dat diff --git a/Changes b/Changes index 6d946d9..5bed277 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,9 @@ Revision history for HTML-CalendarMonth +1.26 Fri Aug 26 15:08:49 EDT 2011 + - fixed css/header interactions + - updated tests + 1.25 Fri Sep 24 03:09:38 EDT 2010 - Switched to File::Which for finding cal/ncal - Added some sanity checks for the cal/ncal output diff --git a/LICENSE b/LICENSE index e26392a..e2cf05c 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -This software is copyright (c) 2010 by Matthew Sisk. +This software is copyright (c) 2011 by Matthew Sisk. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. @@ -12,21 +12,22 @@ b) the "Artistic License" --- The GNU General Public License, Version 1, February 1989 --- -This software is Copyright (c) 2010 by Matthew Sisk. +This software is Copyright (c) 2011 by Matthew Sisk. This is free software, licensed under: The GNU General Public License, Version 1, February 1989 - GNU GENERAL PUBLIC LICENSE - Version 1, February 1989 + GNU GENERAL PUBLIC LICENSE + Version 1, February 1989 Copyright (C) 1989 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA + 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. - Preamble + Preamble The license agreements of most software companies try to keep users at the mercy of those companies. By contrast, our General Public @@ -67,7 +68,7 @@ authors' reputations. The precise terms and conditions for copying, distribution and modification follow. - GNU GENERAL PUBLIC LICENSE + GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any program or other work which @@ -185,7 +186,7 @@ make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. - NO WARRANTY + NO WARRANTY 9. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN @@ -207,9 +208,9 @@ YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - END OF TERMS AND CONDITIONS + END OF TERMS AND CONDITIONS - Appendix: How to Apply These Terms to Your New Programs + Appendix: How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to humanity, the best way to achieve this is to make it @@ -235,8 +236,9 @@ the exclusion of warranty; and each file should have at least the GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA + Also add information on how to contact you by electronic and paper mail. @@ -270,7 +272,7 @@ That's all there is to it! --- The Artistic License 1.0 --- -This software is Copyright (c) 2010 by Matthew Sisk. +This software is Copyright (c) 2011 by Matthew Sisk. This is free software, licensed under: diff --git a/MANIFEST b/MANIFEST index 54556bf..88af142 100644 --- a/MANIFEST +++ b/MANIFEST @@ -5,6 +5,7 @@ MANIFEST.SKIP META.json Makefile.PL README +bs.pm dist.ini lib/HTML/CalendarMonth.pm lib/HTML/CalendarMonth/DateTool.pm @@ -27,6 +28,7 @@ t/20_i8n.t t/21_narrow.t t/author-critic.t t/dat/bulk.dat +t/dat/head.dat t/dat/i8n.dat t/dat/narrow.dat t/dat/odd.dat diff --git a/META.json b/META.json index 6b466b3..f73c0d8 100644 --- a/META.json +++ b/META.json @@ -4,7 +4,7 @@ "Matthew P. Sisk " ], "dynamic_config" : 0, - "generated_by" : "Dist::Zilla version 4.101612, CPAN::Meta::Converter version 2.101610", + "generated_by" : "Dist::Zilla version 4.300000, CPAN::Meta::Converter version 2.112150", "license" : [ "perl_5" ], @@ -16,7 +16,7 @@ "prereqs" : { "configure" : { "requires" : { - "ExtUtils::MakeMaker" : "6.31" + "ExtUtils::MakeMaker" : "6.30" } }, "runtime" : { @@ -27,7 +27,10 @@ "File::Which" : 0, "HTML::ElementTable" : "1.18", "Time::Local" : 0, - "constant" : 0 + "base" : 0, + "constant" : 0, + "strict" : 0, + "warnings" : 0 } }, "test" : { @@ -43,6 +46,6 @@ } }, "release_status" : "stable", - "version" : "1.25" + "version" : "1.26" } diff --git a/Makefile.PL b/Makefile.PL index dbaf014..a682cfc 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -4,41 +4,44 @@ use warnings; -use ExtUtils::MakeMaker 6.31; +use ExtUtils::MakeMaker 6.30; my %WriteMakefileArgs = ( - 'ABSTRACT' => 'Generate and manipulate HTML calendar months', - 'AUTHOR' => 'Matthew P. Sisk ', - 'BUILD_REQUIRES' => { - 'Cwd' => '0', - 'English' => '0', - 'Exporter' => '0', - 'File::Spec' => '0', - 'FindBin' => '0', - 'Test::More' => '0', - 'vars' => '0' + "ABSTRACT" => "Generate and manipulate HTML calendar months", + "AUTHOR" => "Matthew P. Sisk ", + "BUILD_REQUIRES" => { + "Cwd" => 0, + "English" => 0, + "Exporter" => 0, + "File::Spec" => 0, + "FindBin" => 0, + "Test::More" => 0, + "vars" => 0 }, - 'CONFIGURE_REQUIRES' => { - 'ExtUtils::MakeMaker' => '6.31' + "CONFIGURE_REQUIRES" => { + "ExtUtils::MakeMaker" => "6.30" }, - 'DISTNAME' => 'HTML-CalendarMonth', - 'EXE_FILES' => [], - 'LICENSE' => 'perl', - 'NAME' => 'HTML::CalendarMonth', - 'PREREQ_PM' => { - 'Carp' => '0', - 'Class::Accessor' => '0', - 'DateTime::Locale' => '0.45', - 'File::Which' => '0', - 'HTML::ElementTable' => '1.18', - 'Time::Local' => '0', - 'constant' => '0' + "DISTNAME" => "HTML-CalendarMonth", + "EXE_FILES" => [], + "LICENSE" => "perl", + "NAME" => "HTML::CalendarMonth", + "PREREQ_PM" => { + "Carp" => 0, + "Class::Accessor" => 0, + "DateTime::Locale" => "0.45", + "File::Which" => 0, + "HTML::ElementTable" => "1.18", + "Time::Local" => 0, + "base" => 0, + "constant" => 0, + "strict" => 0, + "warnings" => 0 }, - 'VERSION' => '1.25', - 'test' => { - 'TESTS' => 't/*.t' + "VERSION" => "1.26", + "test" => { + "TESTS" => "t/*.t" } ); diff --git a/bs.pm b/bs.pm new file mode 100644 index 0000000..e97acbe --- /dev/null +++ b/bs.pm @@ -0,0 +1,23 @@ +package bs; + +use Moose; +with 'Dist::Zilla::Role::VersionProvider'; +with 'Dist::Zilla::Role::ModuleInfo'; + +sub provide_version { + my ($self) = @_; + + my $main_module = $self->zilla->main_module; + my $module = $main_module->name; + + my $pm_info = $self->get_module_info($main_module); + my $ver = $pm_info->version; + + die "Unable to get version from $module" unless defined $ver; + + $self->log("dist version $ver (from $module)"); + + "$ver"; +} + +1; diff --git a/debian/changelog b/debian/changelog index 6a1a64c..0d993a5 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +libhtml-calendarmonth-perl (1.26-1) UNRELEASED; urgency=low + + * New upstream release + + -- Don Armstrong Thu, 22 Sep 2011 14:23:16 -0700 + libhtml-calendarmonth-perl (1.25-1) unstable; urgency=low * New upstream release diff --git a/debian/control b/debian/control index a1e51be..8bbd5c8 100644 --- a/debian/control +++ b/debian/control @@ -1,7 +1,7 @@ Source: libhtml-calendarmonth-perl Section: perl Priority: extra -Standards-Version: 3.9.1 +Standards-Version: 3.9.2 Maintainer: Don Armstrong Build-Depends: debhelper (>= 7) Build-Depends-Indep: libhtml-element-extended-perl (>=1.18-0), libdatetime-locale-perl, libclass-accessor-perl, libdate-calc-perl, libdate-manip-perl, libdatetime-perl, libfile-which-perl diff --git a/debian/rules b/debian/rules index c5814f2..88a6d42 100755 --- a/debian/rules +++ b/debian/rules @@ -5,6 +5,9 @@ DESTDIR=$(CURDIR)/debian/$(shell dh_listpackages|head -n 1) +build-arch: build +build-indep: build + build: build-stamp build-stamp: dh_testdir diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 0000000..9f8e9b6 --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +1.0 \ No newline at end of file diff --git a/dist.ini b/dist.ini index 11692d6..c4d6cf1 100644 --- a/dist.ini +++ b/dist.ini @@ -1,10 +1,9 @@ name = HTML-CalendarMonth +version = 1.26 author = Matthew P. Sisk license = Perl_5 copyright_holder = Matthew Sisk -[VersionFromModule] - [NextRelease] format = %-5v %{eee LLL dd HH:MM:ss zzz yyyy}d @@ -24,7 +23,7 @@ format = %-5v %{eee LLL dd HH:MM:ss zzz yyyy}d [PkgVersion] -[AutoPrereq] +[AutoPrereqs] skip = ^testload|Date::Calc|Date::Manip|DateTime$ [Manifest] diff --git a/lib/HTML/CalendarMonth.pm b/lib/HTML/CalendarMonth.pm index 425f9c7..6014d60 100644 --- a/lib/HTML/CalendarMonth.pm +++ b/lib/HTML/CalendarMonth.pm @@ -1,14 +1,12 @@ package HTML::CalendarMonth; -BEGIN { - $HTML::CalendarMonth::VERSION = '1.25'; +{ + $HTML::CalendarMonth::VERSION = '1.26'; } use strict; use warnings; use Carp; -BEGIN { $HTML::CalendarMonth::VERSION = 1.25 } - use HTML::ElementTable 1.18; use HTML::CalendarMonth::Locale; use HTML::CalendarMonth::DateTool; @@ -241,17 +239,15 @@ sub _gencal { $self->item($self->year)->replace_content($self->item_alias($self->year)); if ($self->_head_my) { - if ($self->head_m) { - $self->item($self->month)->attr('colspan',$width - $self->year_span); + if ($self->head_m && $self->head_y) { + $self->item($self->year) ->attr('colspan', $self->year_span); + $self->item($self->month)->attr('colspan', $width - $self->year_span); } - else { + elsif ($self->head_y) { $self->item($self->month)->mask(1); $self->item($self->year)->attr('colspan', $width); } - if ($self->head_y) { - $self->item($self->year)->attr('colspan',$self->year_span); - } - else { + elsif ($self->head_m) { $self->item($self->year)->mask(1); $self->item($self->month)->attr('colspan', $width); } @@ -307,11 +303,14 @@ sub _gencal { # css classes if ($self->enable_css) { - $self ->push_attr(class => 'hcm-table' ); - $self->item_row($self->dayheaders)->push_attr(class => 'hcm-day-head' ); - $self->item ($self->year) ->push_attr(class => 'hcm-year-head' ); - $self->item ($self->month) ->push_attr(class => 'hcm-month-head'); - $self->item ($self->week_nums) ->push_attr(class => 'hcm-week-head' ) + $self->push_attr(class => 'hcm-table'); + $self->item_row($self->dayheaders)->push_attr(class => 'hcm-day-head') + if $self->head_dow; + $self->item($self->year)->push_attr(class => 'hcm-year-head') + if $self->head_y; + $self->item($self->month)->push_attr(class => 'hcm-month-head') + if $self->head_m; + $self->item($self->week_nums) ->push_attr(class => 'hcm-week-head') if $self->head_week; } @@ -1080,6 +1079,10 @@ Specifies whether to display the year header. Default 1. Specifies whether to display days of the week header. Default 1. +=item head_week + +Specifies whether to display the week-of-year numbering. Default 0. + =item locale Specifies the id of the locale in which to render the calendar. Default @@ -1108,10 +1111,6 @@ custom label you prefer. Lookups, such as C, will still use the locale string, but when the calendar is rendered the aliased value will appear. -=item head_week - -Specifies whether to display the week-of-year numbering. Default 0. - =item week_begin Specify first day of the week, which can be 1..7, starting with Sunday. diff --git a/lib/HTML/CalendarMonth/DateTool.pm b/lib/HTML/CalendarMonth/DateTool.pm index 91df572..0e752a3 100644 --- a/lib/HTML/CalendarMonth/DateTool.pm +++ b/lib/HTML/CalendarMonth/DateTool.pm @@ -1,6 +1,6 @@ package HTML::CalendarMonth::DateTool; -BEGIN { - $HTML::CalendarMonth::DateTool::VERSION = '1.25'; +{ + $HTML::CalendarMonth::DateTool::VERSION = '1.26'; } # Base class for determining what date calculation package to use. @@ -210,6 +210,8 @@ sub _summon_date_class { my $self = shift; my @tools; if (my $c = $self->datetool) { + eval "use $c"; + die "invalid date tool $c : $@" if $@; @tools = $c->_name; } else { @@ -228,7 +230,7 @@ sub _summon_date_class { } return $dc if $dc; if (@tools == 1) { - croak "invalid date tool " . join(': ', @{$fails[0]}) if @tools == 1; + croak "invalid date tool " . join(': ', @{$fails[0]}); } else { croak join("\n", @@ -301,6 +303,8 @@ sub _datemanip_fails { return "not installed" unless $self->_datemanip_present; return "historic mode prior to 1752/09 not supported" if $self->historic && $self->_is_julian; + eval { require Date::Manip && Date::Manip::Date_Init() }; + return "init failure: $@" if $@; return; } @@ -311,6 +315,7 @@ sub _datemanip_present { eval "require Date::Manip"; return !$@ } sub _ncal_present { shift->_ncal_cmd } sub _cal_present { shift->_cal_cmd }; + 1; __END__ diff --git a/lib/HTML/CalendarMonth/DateTool/Cal.pm b/lib/HTML/CalendarMonth/DateTool/Cal.pm index 2d63e00..e416528 100644 --- a/lib/HTML/CalendarMonth/DateTool/Cal.pm +++ b/lib/HTML/CalendarMonth/DateTool/Cal.pm @@ -1,6 +1,6 @@ package HTML::CalendarMonth::DateTool::Cal; -BEGIN { - $HTML::CalendarMonth::DateTool::Cal::VERSION = '1.25'; +{ + $HTML::CalendarMonth::DateTool::Cal::VERSION = '1.26'; } # Interface to unix 'cal' command diff --git a/lib/HTML/CalendarMonth/DateTool/DateCalc.pm b/lib/HTML/CalendarMonth/DateTool/DateCalc.pm index 38cbcbb..c359994 100644 --- a/lib/HTML/CalendarMonth/DateTool/DateCalc.pm +++ b/lib/HTML/CalendarMonth/DateTool/DateCalc.pm @@ -1,6 +1,6 @@ package HTML::CalendarMonth::DateTool::DateCalc; -BEGIN { - $HTML::CalendarMonth::DateTool::DateCalc::VERSION = '1.25'; +{ + $HTML::CalendarMonth::DateTool::DateCalc::VERSION = '1.26'; } # Interface to Date::Calc diff --git a/lib/HTML/CalendarMonth/DateTool/DateManip.pm b/lib/HTML/CalendarMonth/DateTool/DateManip.pm index d13283a..2531d1d 100644 --- a/lib/HTML/CalendarMonth/DateTool/DateManip.pm +++ b/lib/HTML/CalendarMonth/DateTool/DateManip.pm @@ -1,6 +1,6 @@ package HTML::CalendarMonth::DateTool::DateManip; -BEGIN { - $HTML::CalendarMonth::DateTool::DateManip::VERSION = '1.25'; +{ + $HTML::CalendarMonth::DateTool::DateManip::VERSION = '1.26'; } # Interface to Date::Manip diff --git a/lib/HTML/CalendarMonth/DateTool/DateTime.pm b/lib/HTML/CalendarMonth/DateTool/DateTime.pm index a0b98b3..b0727ac 100644 --- a/lib/HTML/CalendarMonth/DateTool/DateTime.pm +++ b/lib/HTML/CalendarMonth/DateTool/DateTime.pm @@ -1,6 +1,6 @@ package HTML::CalendarMonth::DateTool::DateTime; -BEGIN { - $HTML::CalendarMonth::DateTool::DateTime::VERSION = '1.25'; +{ + $HTML::CalendarMonth::DateTool::DateTime::VERSION = '1.26'; } # Interface to DateTime diff --git a/lib/HTML/CalendarMonth/DateTool/Ncal.pm b/lib/HTML/CalendarMonth/DateTool/Ncal.pm index 22fff0f..144f0a1 100644 --- a/lib/HTML/CalendarMonth/DateTool/Ncal.pm +++ b/lib/HTML/CalendarMonth/DateTool/Ncal.pm @@ -1,6 +1,6 @@ package HTML::CalendarMonth::DateTool::Ncal; -BEGIN { - $HTML::CalendarMonth::DateTool::Ncal::VERSION = '1.25'; +{ + $HTML::CalendarMonth::DateTool::Ncal::VERSION = '1.26'; } # Interface to linux 'ncal' command diff --git a/lib/HTML/CalendarMonth/DateTool/TimeLocal.pm b/lib/HTML/CalendarMonth/DateTool/TimeLocal.pm index e04321b..d107edb 100644 --- a/lib/HTML/CalendarMonth/DateTool/TimeLocal.pm +++ b/lib/HTML/CalendarMonth/DateTool/TimeLocal.pm @@ -1,6 +1,6 @@ package HTML::CalendarMonth::DateTool::TimeLocal; -BEGIN { - $HTML::CalendarMonth::DateTool::TimeLocal::VERSION = '1.25'; +{ + $HTML::CalendarMonth::DateTool::TimeLocal::VERSION = '1.26'; } # Interface to Time::Local diff --git a/lib/HTML/CalendarMonth/Locale.pm b/lib/HTML/CalendarMonth/Locale.pm index 3459992..f01543f 100644 --- a/lib/HTML/CalendarMonth/Locale.pm +++ b/lib/HTML/CalendarMonth/Locale.pm @@ -1,6 +1,6 @@ package HTML::CalendarMonth::Locale; -BEGIN { - $HTML::CalendarMonth::Locale::VERSION = '1.25'; +{ + $HTML::CalendarMonth::Locale::VERSION = '1.26'; } # Front end class around DateTime::Locale. In addition to providing diff --git a/t/author-critic.t b/t/author-critic.t index 7f47387..af7f7ea 100644 --- a/t/author-critic.t +++ b/t/author-critic.t @@ -16,4 +16,5 @@ use English qw(-no_match_vars); eval "use Test::Perl::Critic"; plan skip_all => 'Test::Perl::Critic required to criticise code' if $@; +Test::Perl::Critic->import( -profile => "perlcritic.rc" ) if -e "perlcritic.rc"; all_critic_ok(); diff --git a/t/dat/head.dat b/t/dat/head.dat new file mode 100644 index 0000000..2e410b7 --- /dev/null +++ b/t/dat/head.dat @@ -0,0 +1,16 @@ +2010/01 0 0 0 0 1 +
12
3456789
10111213141516
17181920212223
24252627282930
31
+2010/01 0 0 0 0 2 +
123
45678910
11121314151617
18192021222324
25262728293031
+2010/01 0 0 0 1 1 +
1253
34567891
101112131415162
171819202122233
242526272829304
315
+2010/01 0 0 0 1 2 +
12353
456789101
111213141516172
181920212223243
252627282930314
+2010/01 0 0 1 0 1 +
SunMonTueWedThuFriSat
12
3456789
10111213141516
17181920212223
24252627282930
31
+2010/01 0 0 1 0 2 +
MonTueWedThuFriSatSun
123
45678910
11121314151617
18192021222324
25262728293031
+2010/01 0 0 1 1 1 +
SunMonTueWedThuFriSat
1253
34567891
101112131415162
171819202122233
242526272829304
315
+2010/01 0 0 1 1 2 +
MonTueWedThuFriSatSun
12353
456789101
111213141516172
181920212223243
252627282930314
diff --git a/t/testload.pm b/t/testload.pm index 1c30d0f..fc4f230 100644 --- a/t/testload.pm +++ b/t/testload.pm @@ -16,6 +16,7 @@ require Exporter; use vars qw( $Dat_Dir $Bulk_File + $Head_File $Odd_File $Woy_File $I8N_File @@ -24,7 +25,7 @@ use vars qw( @EXPORT = qw( $Dat_Dir - $Bulk_File $Odd_File $Woy_File $I8N_File $Narrow_File + $Bulk_File $Head_File $Odd_File $Woy_File $I8N_File $Narrow_File check_datetool check_bulk_with_datetool check_odd_with_datetool @@ -53,12 +54,13 @@ BEGIN { } $Bulk_File = File::Spec->catdir($Dat_Dir, 'bulk.dat'); +$Head_File = File::Spec->catdir($Dat_Dir, 'head.dat'); $Odd_File = File::Spec->catdir($Dat_Dir, 'odd.dat'); $Woy_File = File::Spec->catdir($Dat_Dir, 'woy.dat'); $I8N_File = File::Spec->catdir($Dat_Dir, 'i8n.dat'); $Narrow_File = File::Spec->catdir($Dat_Dir, 'narrow.dat'); -my(@Bulk, @Odd, @Woy, @I8N, @Nar); +my(@Bulk, @Head, @Odd, @Woy, @I8N, @Nar); sub _load_file { my $f = shift; @@ -67,22 +69,24 @@ sub _load_file { return unless open(F, '<', $f); while (my $h = ) { chomp $h; - my($d, $wb) = split(/\s+/, $h); + my($d, $wb, @other) = split(/\s+/, $h); my($y, $m) = split(/\//, $d); my $c = ; chomp $c; - push(@$cal, [$d, $y, $m, $wb, clean($c)]); + push(@$cal, [$d, $y, $m, $wb, \@other, clean($c)]); } $cal; } -_load_file($Bulk_File, \@Bulk ); -_load_file($Odd_File, \@Odd ); -_load_file($Woy_File, \@Woy ); -_load_file($I8N_File, \@I8N ); -_load_file($Narrow_File, \@Nar); +_load_file($Bulk_File, \@Bulk ); +_load_file($Head_File, \@Head ); +_load_file($Odd_File, \@Odd ); +_load_file($Woy_File, \@Woy ); +_load_file($I8N_File, \@I8N ); +_load_file($Narrow_File, \@Nar); sub bulk_count { scalar @Bulk } +sub head_count { scalar @Head } sub odd_count { scalar @Odd } sub woy_count { scalar @Woy } sub i8n_count { scalar @I8N } @@ -121,7 +125,7 @@ sub check_bulk_with_datetool { my $datetool = shift; my @days; foreach (@Bulk) { - my($d, $y, $m, $wb, $tc) = @$_; + my($d, $y, $m, $wb, $other, $tc) = @$_; my $c = HTML::CalendarMonth->new( year => $y, month => $m, @@ -140,11 +144,37 @@ sub check_bulk_with_datetool { } } +sub check_head_with_datetool { + my $datetool = shift; + my @days; + foreach (@Head) { + my($d, $y, $m, $wb, $other, $tc) = @$_; + my($hm, $hy, $hd, $hw) = @$other; + my $c = HTML::CalendarMonth->new( + year => $y, + month => $m, + week_begin => $wb, + head_m => $hm, + head_y => $hy, + head_dow => $hd, + head_week => $hw, + datetool => $datetool, + ); + my $method = $c->_caltool->_name; + $method = "auto-select ($method)" unless $datetool; + my $msg = sprintf( + "(%d/%02d hm:%d hy:%d hd:%d hw:%d) using %s", + $y, $m, $hm, $hy, $hd, $hw, $method + ); + cmp_ok(clean($c->as_HTML), 'eq', $tc, $msg); + } +} + sub check_odd_with_datetool { my $datetool = shift; my @days; foreach (@Odd) { - my($d, $y, $m, $wb, $tc) = @$_; + my($d, $y, $m, $wb, $other, $tc) = @$_; SKIP: { my $c; eval { @@ -157,7 +187,7 @@ sub check_odd_with_datetool { }; if ($@ || !$c) { croak $@ unless $@ =~ /(no|in)\s*valid date tool/i; - skip("$datetool skip odd $y/$m", 1); + skip("$datetool odd $y/$m", 1); } @days = $c->dayheaders unless @days; my $day1 = $days[$wb - 1]; @@ -175,7 +205,7 @@ sub check_odd_with_datetool { sub check_woy_with_datetool { my $datetool = shift; foreach (@Woy) { - my($d, $y, $m, $wb, $tc) = @$_; + my($d, $y, $m, $wb, $other, $tc) = @$_; my $c = HTML::CalendarMonth->new( year => $y, month => $m, @@ -189,7 +219,7 @@ sub check_woy_with_datetool { sub check_i8n { foreach (@I8N) { - my($d, $y, $m, $id, $tc) = @$_; + my($d, $y, $m, $id, $other, $tc) = @$_; my $c = HTML::CalendarMonth->new( year => $y, month => $m, @@ -207,7 +237,7 @@ sub check_i8n { sub check_narrow { my @days; foreach (@Nar) { - my($d, $y, $m, $wb, $tc) = @$_; + my($d, $y, $m, $wb, $other, $tc) = @$_; my $c = HTML::CalendarMonth->new( year => $y, month => $m, -- 2.39.2