Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Issues with DBIx::Class

by 1nickt (Canon)
on Mar 23, 2022 at 17:56 UTC ( [id://11142337]=note: print w/replies, xml ) Need Help??


in reply to Issues with DBIx::Class

Besides the module Your Mother suggested, you can use an idiom like:

for my $result_as_href ( map { $_->get_columns } $rs->all ) { # do something with the hash ref }
I use this in debugging all the time.

Hope this helps!

,bR>
The way forward always starts with a minimal test.

Replies are listed 'Best First'.
Re^2: Issues with DBIx::Class
by NERDVANA (Deacon) on Mar 24, 2022 at 02:25 UTC
    map syntax is wrong, it should be map +{ $_->get_columns }, $rs->all
Re^2: Issues with DBIx::Class
by LittleJack (Beadle) on Mar 24, 2022 at 00:37 UTC

    Thanks for your help. I'm doing exactly what you said and not getting individual hashrefs in Data::Dumper output.

    Instead I get each column by itself, one line per loop:

    $VAR1 = 'id'; $VAR1 = 99; $VAR1 = 'some_thing'; $VAR1 = 'bar';

    Is there some missing step in your method, or am I missing something again?

      Sorry, I missed a curly brace pair.

      for my $result_as_href ( map { { $_->get_columns } } $rs->all ) { # do something with the hash ref }

      The way forward always starts with a minimal test.

        Thanks for following up! I still find it a little strange that DBIxC doesn't have a built-in method which returns a hash but I guess it's all about being very low level, and if I want an as_hashref() method or any other method like that, I can write my own in a ResultSet.pm

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11142337]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (5)
As of 2024-04-19 03:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found