[Dbix-class] get_columns() with inflaters

Matt S Trout dbix-class at trout.me.uk
Wed Mar 29 23:03:04 CEST 2006


Michele Beltrame wrote:
> Hello!
> 
> I need to copy all the columns of a row object into an hash, so I do:
> 
> my $o = $c->model('Dbs')->resultset('Book')->find($id);
> my %myhash = $o->get_columns;
> 
> This works fine, but inflaters are not called: that is, I get the data
> exactly as it is stored in the database.
> 
> I suspect this is intended but... is there a way to automatically get
> all the columns into an hash *running* the inflaters as well?

my %hash = map { ($_ => $o->$_) } $o->columns;

?

-- 
      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