[Dbix-class] select specific columns on resultset

Peter Rabbitson rabbit+dbic at rabbit.us
Wed Apr 10 03:32:02 GMT 2013


On Tue, Apr 09, 2013 at 03:58:53PM +0200, max wrote:
> Thanks for the answer, this piece of code is inside a perl sub, I tried to
> extract the array elements as:
> 
> foreach my $row (@recs)
> {
> my $id=$row->id;
> my $name=$row->Name;
> print MYFILE "recs name: $name, id: $id\n\n";
> }
> 
> and I can see the Name element for example.

Well... you asked for it didn't you? (in fact you asked twice)

> columns => [qw/id Name OperationId Name /]

I am at this point confused what is your problem exactly...

> I tried to insert the DBIC_TRACE
> in the sub ouputting it to a file but it's always empty (
> $self->db->storage->debugfh(IO::File->new('file','w'));), is there another
> way to use it ?

When you use it this way you also need to ->storage->debug(1) for things
to start working. During debugging DBIC_TRACE=1 with dump to screen is
much more common, hence why noone answered quuckly ;)

Cheers



More information about the DBIx-Class mailing list