Re: Class::DBI and Time::Piece::MySQL woes

[prev] [thread] [next] [Date index for 2004/06/11]

From: Vince Veselosky
Subject: Re: Class::DBI and Time::Piece::MySQL woes
Date: 13:58 on 11 Jun 2004
Yes, I found that a bit strange myself. Time::Piece::MySQL actually=20
modifies the Time::Piece package itself, effectively acting as a=20
superclass rather than a subclass. So you really want to say

use Time::Piece::MySQL;
__PACKAGE__->has_a(angelegt =3D> 'Time::Piece',
        inflate =3D> sub { Time::Piece->from_mysql_datetime( shift ); },
        deflate =3D> 'mysql_datetime',
);

It's a bit counter-intuitive, but it works.

-Vince


Alexander Gr=E4fe wrote:

>Hi,
>
>After upgrading to Class::DBI 0.96,
>the following does not work anymore:
>
>__PACKAGE__->has_a(angelegt =3D> 'Time::Piece::MySQL',
>        inflate =3D> sub { Time::Piece->from_mysql_datetime( shift ); },=

>        deflate =3D> 'mysql_datetime',
>);
>
>The error I get is:
>
>Inflate method didn't inflate right at
>/usr/lib/perl5/site_perl/5.8.0/Class/DBI/Relationship/HasA.pm line 59
>
>Looking at HasA.pm, I suspect the problem is, that I tell CDBI, that
>'angelegt' is a Time::Piece::MySQL object, but the object isn't really
>Time::Piece::MySQL, rather, it's just Time::Piece.
>
>I really would like to avoid having to copy the Time::Piece::MySQL code
>into my CDBI class, so is there an easy way I can keep on using T::P::M?=

>
>Regards,
>	Alexander Gr=E4fe
> =20
>

Class::DBI and Time::Piece::MySQL woes
Alexander =?iso-8859-1?Q?Gr=E4fe?= 13:14 on 11 Jun 2004

Re: Class::DBI and Time::Piece::MySQL woes
Vince Veselosky 13:58 on 11 Jun 2004

Re: Class::DBI and Time::Piece::MySQL woes
Alexander =?iso-8859-1?Q?Gr=E4fe?= 14:03 on 11 Jun 2004

Generated at 11:35 on 01 Dec 2004 by mariachi v0.52