Skip Menu |
 

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

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

Report information
The Basics
Id: 93863
Status: resolved
Priority: 0/
Queue: DateTime-Format-Strptime

People
Owner: Nobody in particular
Requestors: mcarey [...] ucar.edu
Cc:
AdminCc:

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



Subject: Bug in generating regex for weekday names
Date: Fri, 14 Mar 2014 11:23:51 -0600
To: bug-datetime-format-strptime [...] rt.cpan.org
From: Maxwell Carey <mcarey [...] ucar.edu>
Download (untitled) / with headers
text/plain 986b
In _build_parser, the regex for matching weekday names is generated with the following code: my $day_re = join( '|', map { quotemeta $_ } sort { length $b <=> length $a } grep( /\W/, @{ $self->{_locale}->day_format_wide }, @{ $self->{_locale}->day_format_abbreviated } ) ); $day_re .= '|' if $day_re; $regex =~ s/%a/($day_re\\w+)/gi; $field_list =~ s/%a/#dow_name#/gi; The grep only matches names containing non-word characters (\W), which for the 'en_EN' locale is nothing. The generated regex becomes simply \w+ This causes bizarre problems like the following: #!/usr/bin/perl use strict; use warnings; use DateTime::Format::Strptime; my $strp = DateTime::Format::Strptime->new( pattern => '%a%m%d_%Y', on_error => 'croak', locale => 'en_EN' ); my $dt = $strp->parse_datetime('Fri0215_2013'); __END__ Fri02 is not a recognised day in this locale. at foo line 13.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.