[Dbix-class] InflateColumn::DateTime

Matt S Trout dbix-class at trout.me.uk
Fri Jun 9 16:20:13 CEST 2006


Christopher H. Laco wrote:
>> My problem is in deflate:
>>
>>>       $column =>
>>>         {
>>>           inflate => sub {
>>>             my ($value, $obj) = @_;
>>>             $obj->_datetime_parser->parse_datetime($value);
>>>           },
>>>           deflate => sub {
>>>             my ($value, $obj) = @_;
>> 		$obj is not an object, just a class name during a create_related calls?
>>>             $obj->_datetime_parser->format_datetime($value);
>>>           },
>>>         }
>>
>>
>> Is it normal that the deflate sub get's a class name, and not an actuall
>> blessed object for $obj?
>>
>> -=Chris
>>
> 
> OK, The offending bits are:
> 
>>   if (my $parser = $self->__datetime_parser) {
>>     return $parser;
>>   }
> 
> from _datetime_parser() in InflateColumn::DateTime.
> 
> If it is indeed normal deflate subs to get a class and not an object,
> then that line won't cut it because of the accessors trying to look at a
> blessed hash.
> 
> If it's not normal for deflate subs to get class names instead of
> objects for $obj, then something is quite amiss elsewhere.
> 
> Considering regular inflate/deflate works with my copy-item code, I'm
> betting on the former here.
> 
> Someone who know more about the internals will have to chime in.

Commit the anti-warnings patch to current please and add a failing test for 
this issue. I'll have a look at it later.

-- 
      Matt S Trout       Offering custom development, consultancy and support
   Technical Director    contracts for Catalyst, DBIx::Class and BAST. Contact
Shadowcat Systems Ltd.  mst (at) shadowcatsystems.co.uk for more information

+ Help us build a better perl ORM: http://dbix-class.shadowcatsystems.co.uk/ +



More information about the Dbix-class mailing list