in reply to Date conversion with Class::DBI

I'm using something like this:
my $class=__PACKAGE__; $class->has_a ( date=>'DateTime::Format::MySQl', inflate=>sub {DateTime::Format::MySQL->parse_datetime(shift)} );
And than:
$obj->date->year; # or whatever, see perldoc DateTime

Replies are listed 'Best First'.
Re: Re: Date conversion with Class::DBI
by domm (Chaplain) on Jul 07, 2003 at 11:18 UTC
    Argh. I forgot to log in (damn browser was blocking cookies..) Anyway, the above node is by me..
    -- #!/usr/bin/perl for(ref bless{},just'another'perl'hacker){s-:+-$"-g&&print$_.$/}