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?


In reply to cdbi module dies with: Can't use an undefined value as an ARRAY reference by bergbrains

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.