I don't know if I'm misunderstanding something fundamental here, but here's the situation:

I have a module: package Model::DB::Result::Thing; and it looks basically like this:

package Model::DB::Result::Thing; use warnings; use base 'DBIx::Class::Core'; __PACKAGE__->table("table_in_postgres"); __PACKAGE__->add_columns( "id", { data_type => "integer", is_auto_increment => 1, is_nullable => 0, sequence => "things_id_seq", }, "some_thing", { data_type => "text", is_nullable => 0, }, );
and Model::DB is just
package Model::DB; use strict; use warnings; use base 'DBIx::Class::Schema'; __PACKAGE__->load_namespaces; 1;

All the other parts of my codebase (a legacy Catalyst App) seem happy with it, and I can do some things with it which show that it's connecting to the DB correctly, see below.

What I can't do it seems is get a simple set of results back with all() or search()

What I'm expecting, as per this page https://metacpan.org/release/RIBASUSHI/DBIx-Class-0.082841/view/lib/DBIx/Class/ResultSet.pm is that I do my $thing_rs = $c->model('DB::Thing')->all(); but when I do that and use Data::Dumper I get an integer, the number of rows: $VAR1 = 123;

So I try calling in list context: my @thing_rs = $c->model('DB::Thing')->all(); and I get $VAR1 as the whole MyApp::Model::DB::Thing object, followed by 123 blessed objects like this:

$VAR2 = bless( { '_result_source' => $VAR1->{'_result_source'}, '_in_storage' => 1, '_column_data' => { 'some_thing' => 'foo', 'id' => 99, } }, 'MyApp::Model::DB::Thing' );

What I'm expecting is an array of hashes containing what I see there in the blessed objects, i.e.

[ { 'some_thing' => 'foo', 'id' => 99, }, { 'some_thing' => 'bar', 'id' => 100, }, # etc ]

So I'm kind of stumped. Is something different because it's PostGres? Is my version of DBIxC (0.082840) weird? TIA Monks!


In reply to Issues with DBIx::Class by LittleJack

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.