Dave Rolsky wrote:
I tend to not favor this sort of API, because it's basically a global. That means that if two CPAN modules both set it, the last one to call this method wins. It also doesn't play nice with mod_perl, where you may be running multiple apps under one persistent interpreter.

Many (some?) of the other format modules let you create a format object and then call the parse_datetime method on that object. This is specifically so you can set options that don't become globals.

Eg:

my $parser = new DateTime::Format::MySQL(
        time_zone => "UTC"
);

my $dt = $parser->parse_datetime( $db_data );

print $dt->time_zone->name;
# UTC

It would be fairly easy for Nick to look at the way other Format modules do it and submit a patch for DT:F:MySQL to do this...

Cheers!
Rick Measham

Reply via email to