bergbrains has asked for the wisdom of the Perl Monks concerning the following question:
Greetings, Monks. I turn here to ask a question regarding some strange stuff going on with my Class::DBI modules.
My env:
Class::DBI: 3.0.17
DBI 1.16
Perl 5.12.3
DBD::Sybase 1.12
First, it seems relevant to mention that I've started to see this error, though i've seen it before and it hasn't seemed to cause any problems:
Use of uninitialized value in lc at /blah/path/Class/DBI.pm line 196.Beyond that, I've got a relatively simple Class::DBI subclass that gets a DB handle from one of our modules (which is working with other mods), and for one of our cdbi mods it's failing thusly:
MyStuff::Blob can't SELECT blob_num, blob_name, blob_type, user_id, de +scription, create_timestamp, modify_timestamp, blob_subtype, perms, b +lob_access, access_timestamp, read_entitlement, index_family FROM blob WHERE blob_num = ? : Can't use an undefined value as an ARRAY reference at /path/to/mods/ +Class/DBI.pm line 1140.
It indicates that the problem is in this subroutine in Class::DBI:
sub sth_to_objects { my ($class, $sth, $args) = @_; $class->_croak("sth_to_objects needs a statement handle") unless $ +sth; unless (UNIVERSAL::isa($sth => "DBI::st")) { my $meth = "sql_$sth"; $sth = $class->$meth(); } my (%data, @rows); eval { $sth->execute(@$args) unless $sth->{Active}; $sth->bind_columns(\(@data{ @{ $sth->{NAME_lc} } })); push @rows, {%data} while $sth->fetch; }; return $class->_croak("$class can't $sth->{Statement}: $@", err => + $@) if $@; return $class->_ids_to_objects(\@rows); }
...on the line where the $sth->bind_columns() is called. I believe that $sth->{NAME_lc} should be an array ref to a list of lower-cased column names, but it's empty when I do a Dumper on it in the DBI code. Why would my $sth not contain an entry for NAME_lc?
Something's up with the 'FetchHashKeyName' => 'NAME_lc' situation, but I am having trouble figuring out what it is. Can anyone shed any light on this?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: cdbi module dies with: Can't use an undefined value as an ARRAY reference
by runrig (Abbot) on Jun 23, 2011 at 21:50 UTC | |
by bergbrains (Acolyte) on Jun 24, 2011 at 15:23 UTC |