Monks-

I posted this to Class::DBI mailing list, but it doesn't seem to be making it past the moderator.

Just migrated from Debian Woody to RedHat Enterprise 4. I ran my test suites before migration and they were perfect. Now, one of my modules that uses Class::DBI is broken in and odd way on the new system.

I've isolated the problem in the following short script that uses Class::DBI to drill down into a large database. The script works fine when run from the command line, but fails with the errors show below when run through the perl debugger (perl -d test.pl). The failure is of the type "Can't bind a reference (Recode::Bioentry=HASH(0x87864a0)) at ... DBIx/ContextualFetch.pm line 52".

I'm using perl 5.8.5 DBI 1.40 and Class::DBI 3.0.1 (the working Debian system had perl 5.6.1 and CDBI 0.96, but I've reverted to CDBI 0.96 on the failing RH system and get the same results). Any thoughts?<\p>

Barry

========================================== Script ========================================== #!/usr/bin/perl + + use Recode::RecodeDB; my $recode = Recode::Recode->retrieve(21); my $bioentry = $recode->bioentry_id; my $sequence = $bioentry->biosequence; my $seq = $sequence->seq; # $seq = $recode->bioentry_id->biosequence->seq; # has the same effect print "$seq"; ========================================== Snippets from database module Recode::RecodeDB ========================================== package Recode::RecodeDB; use base 'Class::DBI'; use strict; use warnings; Recode::RecodeDB->connection('dbi:Pg:dbname=*****', '******', '********'); ... package Recode::Recode; use base 'Recode::RecodeDB'; use Local::SeqTools qw(translate); use Text::Wrap; $Text::Wrap::columns = 80; Recode::Recode->table('recodes'); Recode::Recode->columns(All => qw/recode_id bioentry_id orf1_begin orf1_end orf2_begin orf2_end frameshift/); Recode::Recode->has_a(bioentry_id => 'Recode::Bioentry'); Recode::Recode->has_many(recode_features => 'Recode::Recode_Features'); Recode::Recode->has_many(homolocodes => 'Recode::Homolocodes'); ... package Recode::Biosequence; use base 'Recode::RecodeDB'; Recode::Biosequence->table('biosequence'); Recode::Biosequence->columns('All' => qw/ bioentry_id version length alphabet seq /); Recode::Biosequence->has_a('bioentry_id' => 'Recode::Bioentry'); ... package Recode::Bioentry; use base 'Recode::RecodeDB'; Recode::Bioentry->table('bioentry'); Recode::Bioentry->columns(All => qw/bioentry_id biodatabase_id taxon_id name accession identifier division description version /); Recode::Bioentry->has_a(biodatabase_id => 'Recode::Biodatabase'); #Recode::Bioentry->has_a(taxon_id => 'Recode::Taxon'); Recode::Bioentry->has_a(taxon_id => 'Recode::Taxon_Name'); Recode::Bioentry->might_have(biosequence => 'Recode::Biosequence' => qw/ length alphabet seq /); Recode::Bioentry->has_many(comments => 'Recode::Comment'); Recode::Bioentry->has_many(recodes => 'Recode::Recode'); Recode::Bioentry->has_many(seqfeatures => 'Recode::SeqFeature'); ========================================== Errors ========================================== Can't bind a reference (Recode::Bioentry=HASH(0x87864a0)) at /usr/lib/ +perl5/site_perl/5.8.5/DBIx/ContextualFetch.pm line 52Can't bind a ref +erence (Recode::Bioentry=HASH(0x87864a0)) at /usr/lib/perl5/site_perl +/5.8.5/DBIx/ContextualFetch.pm line 52. at /usr/lib/perl5/site_perl/ +5.8.5/DBIx/ContextualFetch.pm line 52 DBIx::ContextualFetch::st::_untaint_execute('DBIx::ContextualF +etch::st=HASH(0x8786494)', 'Recode::Bioentry=HASH(0x87864a0)') called + at /usr/lib/perl5/site_perl/5.8.5/DBIx/ContextualFetch.pm line 32 DBIx::ContextualFetch::st::execute('DBIx::ContextualFetch::st= +HASH(0x8786494)', 'Recode::Bioentry=HASH(0x87864a0)') called at /usr/ +lib/perl5/site_perl/5.8.5/DBIx/ContextualFetch.pm line 87 DBIx::ContextualFetch::st::select_row('DBIx::ContextualFetch:: +st=HASH(0x8786494)', 'Recode::Bioentry=HASH(0x87864a0)') called at /u +sr/lib/perl5/site_perl/5.8.5/Class/DBI.pm line 852 Class::DBI::_flesh('Recode::Biosequence=HASH(0x87865f0)', 'All +') called at /usr/lib/perl5/site_perl/5.8.5/Class/DBI.pm line 840 Class::DBI::get('Recode::Biosequence=HASH(0x87865f0)', 'seq') +called at /usr/lib/perl5/site_perl/5.8.5/Class/Accessor.pm line 328 Class::Accessor::__ANON__[/usr/lib/perl5/site_perl/5.8.5/Class +/Accessor.pm:330]('Recode::Biosequence=HASH(0x87865f0)') called at te +st.pl line 11. at /usr/lib/perl5/site_perl/5.8.5/DBIx/ContextualFetc +h.pm line 52 DBIx::ContextualFetch::st::_untaint_execute('DBIx::ContextualF +etch::st=HASH(0x8786494)', 'Recode::Bioentry=HASH(0x87864a0)') called + at /usr/lib/perl5/site_perl/5.8.5/DBIx/ContextualFetch.pm line 32 DBIx::ContextualFetch::st::execute('DBIx::ContextualFetch::st= +HASH(0x8786494)', 'Recode::Bioentry=HASH(0x87864a0)') called at /usr/ +lib/perl5/site_perl/5.8.5/DBIx/ContextualFetch.pm line 87 DBIx::ContextualFetch::st::select_row('DBIx::ContextualFetch:: +st=HASH(0x8786494)', 'Recode::Bioentry=HASH(0x87864a0)') called at /u +sr/lib/perl5/site_perl/5.8.5/Class/DBI.pm line 852 Class::DBI::_flesh('Recode::Biosequence=HASH(0x87865f0)', 'All +') called at /usr/lib/perl5/site_perl/5.8.5/Class/DBI.pm line 840 Class::DBI::get('Recode::Biosequence=HASH(0x87865f0)', 'seq') +called at /usr/lib/perl5/site_perl/5.8.5/Class/Accessor.pm line 328 Class::Accessor::__ANON__[/usr/lib/perl5/site_perl/5.8.5/Class +/Accessor.pm:330]('Recode::Biosequence=HASH(0x87865f0)') called at te +st.pl line 11

In reply to Class::DBI failure within perl debugger by barvin

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.