Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the DateTime-TimeZone CPAN distribution.

Report information
The Basics
Id: 53193
Status: resolved
Priority: 0/
Queue: DateTime-TimeZone

People
Owner: Nobody in particular
Requestors: stolen-from-bitcard [...] l2g.to
Cc:
AdminCc:

Bug Information
Severity: Unimportant
Broken in: 1.07
Fixed in: (no value)



Subject: Patch for DateTime::TimeZone::OlsonDB that may or may not be useful
I ran into a curious problem while building an updated version of perl-DateTime for Fedora (multiple releases, 6 through 12). All of the tests would succeed in Fedora 10, 11, and 12, but a couple of tests would fail in anything older than 10.  (I've attached a complete build log to show the test failures at the end.)

To make a long story short, I was able to get this to work by rewriting a small section of DateTime::TimeZone::OlsonDB (see attached patch). The code that triggered the failing call to DateTime->new() uses a pattern match but spreads out the use of $1, $2, and $3 across the block. I rewrote it to save these in local variables immediately, then use those variables instead of $1, $2, and $3.  The tests then worked.

*Why* this is so, I cannot say. :-)  It may be because the "broken" Fedora distros all have a version of Params::Validate older than 0.91; DateTime requires that, but my builds did not enforce it.

So do with this patch whatever you like; it may be moot.

Subject: bug.log.gz
Download bug.log.gz
application/x-gzip 16.8k

Message body not shown because it is not plain text.

Subject: OlsonDB.pm.patch
diff --git a/lib/DateTime/TimeZone/OlsonDB.pm b/lib/DateTime/TimeZone/OlsonDB.pm index 021202b..2dbe23c 100644 --- a/lib/DateTime/TimeZone/OlsonDB.pm +++ b/lib/DateTime/TimeZone/OlsonDB.pm @@ -222,15 +222,18 @@ sub parse_day_spec } elsif ( $day =~ /^(\w\w\w)([><])=(\d\d?)$/ ) { - my $dow = $DAYS{$1}; + my ( $dow, $less_gt_than, $day ) = ( $1, $2, $3 ); + $dow = $DAYS{$dow}; my $dt = DateTime->new( year => $year, month => $month, - day => $3, + day => $day, time_zone => 'floating', ); - my $dur = $2 eq '<' ? $MINUS_ONE_DAY_DUR : $PLUS_ONE_DAY_DUR; + my $dur = $less_gt_than eq '<' + ? $MINUS_ONE_DAY_DUR + : $PLUS_ONE_DAY_DUR; while ( $dt->day_of_week != $dow ) {
On Mon Dec 28 16:48:11 2009, l2g wrote: Show quoted text
> *Why* this is so, I cannot say. :-) It may be because the "broken" > Fedora > distros all have a version of Params::Validate older than 0.91; > DateTime > requires that, but my builds did not enforce it.
If this is the problem, I'm not inclined to apply the patch. Those prereqs are there for a reason ;)