Revision history for Perl extension HTML-CalendarMonth.
+1.19 Sat Mar 15 00:47:26 EDT 2008
+ - Fixed longstanding test failure due to HTML::Tree (properly)
+ deciding to put quotes around numeric attributes in tags.
+ - Also changed i8n test to Zulu rather than Basque since the
+ DateTime::Local::eu (Basque) module no longer has
+ abbreviated day names
+ - Some of the DateTool modules had a minor bug in add_days() not
+ checking for defined vs 0
+ - I released a calendar-related module update on the Ides of
+ March. I'm just sayin'.
+
1.18 Fri Feb 24 15:53:41 EST 2006
- Fixed some scoping issues in DateTool/DateCalc.pm (thanks
Carl Franks)
-# http://module-build.sourceforge.net/META-spec.html
-#XXXXXXX This is a prototype!!! It will change in the future!!! XXXXX#
-name: HTML-CalendarMonth
-version: 1.18
-version_from: lib/HTML/CalendarMonth.pm
-installdirs: site
-requires:
+--- #YAML:1.0
+name: HTML-CalendarMonth
+version: 1.19
+abstract: ~
+license: ~
+author: ~
+generated_by: ExtUtils::MakeMaker version 6.42
+distribution_type: module
+requires:
Class::Accessor: 0
DateTime::Locale: 0
File::Spec: 0
HTML::ElementTable: 1.15
Time::Local: 0
-
-distribution_type: module
-generated_by: ExtUtils::MakeMaker version 6.30
+meta-spec:
+ url: http://module-build.sourceforge.net/META-spec-v1.3.html
+ version: 1.3
Thanks to William R. Ward for some conceptual nudging. Thanks to Fabian
Aichele, Jarkko Hietaniemi, Wolfgang Jürgensen, and David 'Sniper'
Rigaudiere for some suggestions on global calendar customs. Thanks to
-Gael Marziou, Raul Rivero, T. Bugra Uytun, and Philipp W. for some
-helpful bug spotting.
+Gael Marziou, Raul Rivero, Ricardo Signes, T. Bugra Uytun, and Philipp
+W. for some helpful bug spotting.
COPYRIGHT
-Copyright (c) 1999-2005 Matthew P. Sisk. All rights reserved. All wrongs
+Copyright (c) 1999-2008 Matthew P. Sisk. All rights reserved. All wrongs
revenged. This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
use strict;
use vars qw($VERSION @ISA);
-$VERSION = '1.18';
+$VERSION = '1.19';
use Carp;
=head1 COPYRIGHT
-Copyright (c) 1998-2005 Matthew P. Sisk. All rights reserved. All wrongs
+Copyright (c) 1998-2008 Matthew P. Sisk. All rights reserved. All wrongs
revenged. This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
@ISA = qw(HTML::CalendarMonth::DateTool);
-$VERSION = '0.02';
+$VERSION = '0.03';
use Date::Calc qw(Days_in_Month Day_of_Week Add_Delta_Days
Weeks_in_Year Week_of_Year Week_Number Mktime
sub add_days {
my($self, $delta, $day, $month, $year) = @_;
- $delta || croak "Delta (in days) required.\n";
+ defined $delta || croak "Delta (in days) required.\n";
$day || croak "Day required.\n";
$month ||= $self->month;
$year ||= $self->year;
@ISA = qw(HTML::CalendarMonth::DateTool);
-$VERSION = '0.01';
+$VERSION = '0.02';
use Date::Manip qw(Date_DaysInMonth Date_DayOfWeek DateCalc
UnixDate Date_SecsSince1970);
sub add_days {
my($self, $delta, $day, $month, $year) = @_;
- $delta || croak "Delta (in days) required.\n";
+ defined $delta || croak "Delta (in days) required.\n";
$day || croak "Day required.\n";
$month ||= $self->month;
$year ||= $self->year;
@ISA = qw(HTML::CalendarMonth::DateTool);
-$VERSION = '0.01';
+$VERSION = '0.02';
use DateTime;
sub add_days {
my($self, $delta, $day, $month, $year) = @_;
- $delta || croak "Delta (in days) required.\n";
+ defined $delta || croak "Delta (in days) required.\n";
$day || croak "Day required.\n";
$month ||= $self->month;
$year ||= $self->year;
#!/usr/bin/perl
use strict;
+use FindBin;
+use lib $FindBin::RealBin;
+
+use testload;
use Test::More tests => 2;
use HTML::CalendarMonth;
use HTML::CalendarMonth::Locale;
-my $basque;
+my $zulu;
eval do { local $/; <DATA> };
die "Oops on eval: $@\n" if $@;
+$zulu = dq_nums($zulu);
-# i8n (use basque as example)
+# i8n (use zulu as example)
my @stoof = HTML::CalendarMonth::Locale->locales;
ok(@stoof > 20, 'i8n: locale ids retreived');
-my($year, $month) = (2000, 12);
+my($year, $month) = (2008, 3);
my $b = HTML::CalendarMonth->new(
year => $year,
month => $month,
- head_week => 1,
- locale => 'eu',
+ locale => 'zu',
);
-my $bstr = $b->as_HTML;
+my $bstr = dq_nums($b->as_HTML);
chomp($bstr);
-cmp_ok($bstr, 'eq', $basque, "i8n: ($year/$month : Basque) using auto-detect");
+cmp_ok($bstr, 'eq', $zulu, "i8n: ($year/$month : Zulu) using auto-detect");
__DATA__
-$basque = '<table bgcolor="white" border=1 cellpadding=0 cellspacing=0><tr align="center"><td align="left" colspan=6>abendua</td><td align="center" colspan=2>2000</td></tr><tr align="center"><td align="center">ig</td><td align="center">al</td><td align="center">as</td><td align="center">az</td><td align="center">og</td><td align="center">or</td><td align="center">lr</td><td align="center"> </td></tr><tr align="center"><td align="center"> </td><td align="center"> </td><td align="center"> </td><td align="center"> </td><td align="center"> </td><td align="center">1</td><td align="center">2</td><td align="center">48</td></tr><tr align="center"><td align="center">3</td><td align="center">4</td><td align="center">5</td><td align="center">6</td><td align="center">7</td><td align="center">8</td><td align="center">9</td><td align="center">49</td></tr><tr align="center"><td align="center">10</td><td align="center">11</td><td align="center">12</td><td align="center">13</td><td align="center">14</td><td align="center">15</td><td align="center">16</td><td align="center">50</td></tr><tr align="center"><td align="center">17</td><td align="center">18</td><td align="center">19</td><td align="center">20</td><td align="center">21</td><td align="center">22</td><td align="center">23</td><td align="center">51</td></tr><tr align="center"><td align="center">24</td><td align="center">25</td><td align="center">26</td><td align="center">27</td><td align="center">28</td><td align="center">29</td><td align="center">30</td><td align="center">52</td></tr><tr align="center"><td align="center">31</td><td align="center"> </td><td align="center"> </td><td align="center"> </td><td align="center"> </td><td align="center"> </td><td align="center"> </td><td align="center">1</td></tr></table>';
+$zulu = '<table bgcolor="white" border="1" cellpadding="0" cellspacing="0"><tr align="center"><td align="left" colspan="5">Mashi</td><td align="center" colspan="2">2008</td></tr><tr align="center"><td align="center">Son</td><td align="center">Mso</td><td align="center">Bil</td><td align="center">Tha</td><td align="center">Sin</td><td align="center">Hla</td><td align="center">Mgq</td></tr><tr align="center"><td align="center"> </td><td align="center"> </td><td align="center"> </td><td align="center"> </td><td align="center"> </td><td align="center"> </td><td align="center">1</td></tr><tr align="center"><td align="center">2</td><td align="center">3</td><td align="center">4</td><td align="center">5</td><td align="center">6</td><td align="center">7</td><td align="center">8</td></tr><tr align="center"><td align="center">9</td><td align="center">10</td><td align="center">11</td><td align="center">12</td><td align="center">13</td><td align="center">14</td><td align="center">15</td></tr><tr align="center"><td align="center">16</td><td align="center">17</td><td align="center">18</td><td align="center">19</td><td align="center">20</td><td align="center">21</td><td align="center">22</td></tr><tr align="center"><td align="center">23</td><td align="center">24</td><td align="center">25</td><td align="center">26</td><td align="center">27</td><td align="center">28</td><td align="center">29</td></tr><tr align="center"><td align="center">30</td><td align="center">31</td><td align="center"> </td><td align="center"> </td><td align="center"> </td><td align="center"> </td><td align="center"> </td></tr></table>'
@EXPORT = qw( $Dat_Dir check_datetool case_count
check_basic_with_datetool
check_woy_with_datetool
+ dq_nums
);
use File::Spec;
$pkg = File::Spec->canonpath($INC{$pkg});
my $file;
($vol, $dir, $file) = File::Spec->splitpath($pkg);
- $base_dir = File::Spec->catpath($vol, $dir);
+ $base_dir = File::Spec->catpath($vol, $dir, '');
}
$Dat_Dir = $base_dir;
close(D);
+#############
+
+# guard against HTML::Tree starting to quote numeric attrs as of
+# v3.19_02
+
+sub dq_nums {
+ my $str = shift;
+ $str =~ s/\"(\d+)\"/$1/g;
+ return $str;
+}
+
sub case_count { scalar @Cals }
sub check_datetool {
datetool => $datetool,
);
my $day1 = $days[$cal->[3] - 1];
- cmp_ok($c->as_HTML, 'eq', $cal->[2],
+ cmp_ok(dq_nums($c->as_HTML), 'eq', $cal->[2],
sprintf("(%d/%-02d %s 1st day) using %s",
$cal->[0], $cal->[1], $day1, $method));
if ($DEBUG && $c->as_HTML ne $cal->[2]) {
head_week => 1,
datetool => $datetool,
);
- my $ct = $cal->as_HTML;
+ my $ct = dq_nums($cal->as_HTML);
chomp $ct;
cmp_ok($ct, 'eq', $tc, "($year/$month week of year) using $datetool");
if ($DEBUG && $ct ne $tc) {