[Dbix-class] in- and deflators

Christopher H. Laco claco at chrislaco.com
Thu Mar 2 21:06:48 CET 2006


Bernhard Graf wrote:
> One more question:
> 
> It looks like in- and deflators are only called it the column value is 
> defined.
> 
> Is this intended?

Yes, or so I was told.

You can fix this by:

a) having defaults values that aren't undef
b) explictly decalre the inflate sub on the inflate_columns relation:

For example...

__PACKAGE__->inflate_column('price', {
    inflate => sub {Handel::Currency->new(@_)},
    deflate => sub {shift}
});

will always inflate, even if the price column contains undef

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 187 bytes
Desc: OpenPGP digital signature
Url : http://lists.rawmode.org/pipermail/dbix-class/attachments/20060302/23144a72/attachment.pgp 


More information about the Dbix-class mailing list