[Catalyst] has something like DBI's fetchrow_hashref()?

Robert 'phaylon' Sedlacek rs at 474.at
Mon Dec 18 13:11:02 GMT 2006


Wan wrote:
> hello everyone,
> 
> I use DBIx::Class in my Catalyst project.

As a note: This is _not_ a Catalyst question! Except that you access
your model via Catalyst, it is all only DBIx-Class here. DBIC has
separete documentation and a separate mailinglist.

> my $cfg = $c->model('RTDB::Config')->search({Name =>
> $c->req->param("name")})->first;
> 
> ......
> $cfg->Name;
> $cfg->Value;
> 
> I want to get a hash ref that like this
> 
> .....
> $cfg->{Name};
> $cfg->{Value};

Look at the 'get_columns' method in DBIx::Class::Row. This should be
what you're looking for.

-- 
# Robert 'phaylon' Sedlacek
# Perl 5/Catalyst Developer in Hamburg, Germany
{ EMail => ' rs at 474.at ', Web => ' http://474.at ' }



More information about the Catalyst mailing list