[Dbix-class] Can't call method "resolve" on an undefined value.. How to get column names from $rs

Howe, Tom (IT) Tom.Howe at MorganStanley.com
Thu Oct 16 10:21:49 BST 2008


Hi, I have a couple of Q's regarding DBIx::Class

Firstly, Im getting this error message whenever anything seems to fail instead of the expected SQL/Connection errors

Can't call method "resolve" on an undefined value at .../DBIx-Class/0.08010/lib/perl5/DBIx/Class/Row.pm line 720

Any idea what I might be doing wrong (or is the version im using broken?)

Additionally Im trying to get the column names in a resultset ($rs) and cant figure a nice way of doing it.

The best I have come up with is:

my $cols = $rs->{attrs}{columns} || $rs->{_attrs}{as} || [$rs->result_source->columns];

But it's not very nice to have to dive into $rs internals.

Essentially I am trying to create a webpage table/report from a resultset that other users will create.

I need to retrieve the column names programatically (I don't want the user to have to provide them specifically unless they wish to).

Thanks in advance.

Tom



More information about the DBIx-Class mailing list