Date: | Sat, 9 Aug 2003 12:25:02 -0700 |
To: | spoon [...] cpan.org |
From: | Matthew McGillis <matthew [...] mcgillis.org> |
Subject: | DateTime::Format::Builder |
I'm trying to write a formatter using builder than will accept a
number of common Date Times as input.
The code bellow handles all the test cases I'm after. However I need
it to not croak so that I can take other actions when a bad date is
passed. As best I can tell from the documentation the method in my
class should take care of it however it isn't so obviously I'm
missing something.
Any help you can offer would be appreciated.
Thanks!
package DateTime::Format::Common;
use strict;
use warnings;
use DateTime::Format::Builder(
parsers => {
parse_datetime => [
{strptime=> '%m/%d/%Y%n%I:%M%p'},
{strptime=> '%Y/%m/%d%n%I:%M%p'},
{strptime=> '%m-%d-%Y%n%I:%M%p'},
{strptime=> '%F%n%I:%M%p'},
{strptime=> '%b%n%d,%n%Y%n%I:%M%p'},
{strptime=> '%m/%d/%Y%n%H:%M'},
{strptime=> '%Y/%m/%d%n%H:%M'},
{strptime=> '%m-%d-%Y%n%H:%M'},
{strptime=> '%F%n%H:%M'},
{strptime=> '%b%n%d,%n%Y%n%H:%M'},
{strptime=> '%m/%d/%Y'},
{strptime=> '%Y/%m/%d'},
{strptime=> '%m-%d-%Y'},
{strptime=> '%F'},
{strptime=> '%b%n%d,%n%Y'}
]
}
);
sub on_fail {
return undef;
}
1;