[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:41:25 BST 2008


In fact, I get this error when Anything inside a transaction dies.

$schema->txn_do( sub {  die "blah" } );

Gives

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


Tom Howe
Morgan Stanley | Technology
25 Cabot Square | Canary Wharf | Floor 03
London, E14 4QA
Phone: +44 20 7425-9380
Tom.Howe at MorganStanley.com


> -----Original Message-----
> From: Howe, Tom (IT)
> Sent: 16 October 2008 10:22
> To: DBIx::Class user and developer list
> Subject: [Dbix-class] Can't call method "resolve" on an
> undefined value.. How to get column names from $rs
>
>
> 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
>
> _______________________________________________
> List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
> IRC: irc.perl.org#dbix-class
> SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
> Searchable Archive:
> http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk
>



More information about the DBIx-Class mailing list