Date: | Thu, 01 Jul 2004 11:47:35 -0700 |
From: | Kevin <kevin [...] allpoetry.com> |
Subject: | class::dbi::mysql time::piece inflation exceptions |
To: | mysql [...] tmtm.com |
Hello,
Thanks for writing the class::dbi::mysql module. I'm using it with
maypole, it is very handy.
However, I have a table with a datetime column, and it can have NULL
values if there is no info for it. And I can't figure out how to wrap the
autoinflate => dates value in an eval to catch the exception, as its
obviously a bad idea for it to crash the mod_perl handler.
Any suggestions?
I would use something like
__PACKAGE__->has_a(lastlogin => 'Time::Piece',
inflate => sub { eval {Time::Piece->strptime(shift, "%Y-%m-%d") }},
deflate => 'ymd');# what about seconds? Hmmph.
but the docs mention autoinflate doesn't support the inflate subs. I
guess I'm probablly just stuck handling it myself, but it would be a nice
feature for class::dbi::mysql to handle, though what to do with exceptions
is a difficult question.
Thanks,
Kevin
Allpoetry.com Community Manager
"Say the word before the rain comes"