Skip Menu |

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

Report information
The Basics
Id: 31968
Status: resolved
Priority: 0/
Queue: DateTime-Format-Natural

People
Owner: Nobody in particular
Requestors: rt.cpan [...] sartak.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 0.64
Fixed in: (no value)



Subject: Thrashing of $_
Hi Steven, DateTime-Format-Natural 0.64 can sometimes thrash $_. Here's an example of why that's bad: use DateTime::Format::Natural; my @unparsed = qw/12-28-07 12-29-07/; my %parsed; for (@unparsed) { my $dtfn = DateTime::Format::Natural->new; my $dt = $dtfn->parse_datetime($_); $parsed{$_} = $dt->ymd; } use Data::Dumper; print Dumper \%parsed; # '/' => 2007-12-28 print @unparsed; # // Attached is a patch that fixes this. I had fun tracking it down. :) Shawn
Subject: dollar-underscore.diff
--- lib/DateTime/Format/Natural.pm 2007-12-28 11:52:32.000000000 -0500 +++ lib/DateTime/Format/Natural-new.pm 2007-12-28 11:52:25.000000000 -0500 @@ -104,7 +104,7 @@ $format = join $separator, ($length{4} == 0 ? qw(yyyy mm dd) : qw(dd mm yyyy)); } else { - $separator = do { $_ = $format; + $separator = do { local $_ = $format; tr/a-zA-Z//d; tr/a-zA-Z//cs; quotemeta; };
Resolved as of v0.65.