DateTime::Format::Builder::Parser::Regex
Regex based date parsing
Regex based date parsing
version 0.81
my $parser = DateTime::Format::Builder->create_parser(
regex => qr/^(\d\d\d\d)(\d\d)(\d\d)T(\d\d)(\d\d)(\d\d)$/,
params => [ qw( year month day hour minute second ) ],
);
In addition to the common keys, "Regex" supports:
extra => { year => 2004, time_zone => "Australia/Sydney" },
If only a coderef is supplied, then it is called with arguments of $self, $p and "extra".
In short:
$self->$coderef( %$p, %{ $self->{extra} } );
The method is expected to return a valid DateTime object, or undef in event of failure, but can conceivably return anything it likes. So long as it's 'true'.
See DateTime::Format::Builder for details.
"datetime@perl.org" mailing list.
http://datetime.perl.org/
perl, DateTime, DateTime::Format::Builder
This software is Copyright (c) 2013 by Dave Rolsky.
This is free software, licensed under:
The Artistic License 2.0 (GPL Compatible)