Re: has_a inflate issue

[prev] [thread] [next] [Date index for 2004/12/22]

From: Diona Kidd
Subject: Re: has_a inflate issue
Date: 19:26 on 22 Dec 2004
problem resolved! :)

it's not a custom has_a. it should work similarly to the example given 
in the docs for has regarding inflating to a Time::Piece object..

http://search.cpan.org/~tmtm/Class-DBI-0.96/lib/Class/DBI.pm#has_a

this field is also defined in the Essential columns list. it's as if it 
just can't be inflated.

Was running v. 0.94 and updated to the latest version...the problem 
evaporated!! don't see how it was ever working tho....

thanks for the response Charles!


On Dec 22, 2004, at 1:49 PM, Charles Bailey wrote:

> --On Wednesday, December 22, 2004 6:30:40 PM EST +0000 
> diona@xxxxxxxxx.xxx wrote:
>
>> I normally lurk for a while but I've got an issue with a tight 
>> deadline.
>> I have some code as follows:
>>
>> ## Time Objectification stuff. See Time::Piece & T:P:MySQL for usage
>> __PACKAGE__->has_a(
>>         created => 'Time::Piece',
>>         inflate => sub { Time::Piece->from_mysql_timestamp(shift) },
>>         deflate => 'mysql_timestamp',
>> );
>>
>> __PACKAGE__->has_a(
>>         last_access     => 'Time::Piece',
>>         inflate         => sub { 
>> Time::Piece->from_mysql_timestamp(shift)
>> },         deflate         => 'mysql_timestamp',
>> );
>>
>> I'm getting the error:
>> [Wed Dec 22 13:02:08 2004] [error] Can't inflate created to 
>> Time::Piece
>> via CODE(0x8803dac) using '2004-12-22 13:02:08' at
>> /usr/local/share/perl/5.6.1/Class/Trigger.pm line 51
>>
>> I've tracked this down and the code above is the only place I'm 
>> inflating
>> 'created'. I can't figure out why the code is dying on this...
>
> You aren't by any chance using a custom HasA, are you (or an old 
> CDBI)?  If you use the debugger to step into 
> Class::DBI::Relationship::HasA, can you see why the custom inflator is 
> skipped and an odd coderef gets stuffed into the inflator name?
>
> --
> Regards,
> Charles Bailey  < bailey _at_ newman _dot_ upenn _dot_ edu >
> Newman Center at the University of Pennsylvania

has_a inflate issue
diona 18:30 on 22 Dec 2004

Re: has_a inflate issue
Diona Kidd 19:26 on 22 Dec 2004

Re: has_a inflate issue
Tony Bowden 01:11 on 23 Dec 2004

Re: has_a inflate issue
Diona Kidd 05:20 on 23 Dec 2004

Generated at 12:15 on 16 Jan 2005 by mariachi v0.52