I thought I pretty much understood inheritance, but I am missing something in my latest attempt. I am trying to make a simple class that inherits from DBIx::SQLEngine. I have not attempted to add any methods, just to implement a new() method in MY class that generates an object that @ISA DBIx::SQLEngine. I keep getting an error that looks like I am not actually inheriting any methods from DBIx::SQLEngine. Here is the simple module code (and made change to call to SUPER::new() directly--thanks frodo72):

package Bio::DB::UCSC::DB; use strict; use DBIx::SQLEngine; our @ISA = qw/DBIx::SQLEngine/; sub new { my $proto = shift; my $class = $proto; my $self = $class->SUPER::new(@_); bless($self, $class); return($self); } 1;
And here is a little test script, debugger output, and error message:
#!/usr/bin/perl use strict; use Bio::DB::UCSC::DB; use DBIx::SQLEngine; my $db = Bio::DB::UCSC::DB->new('dbi:mysql:database=hg18','uname','pas +swd'); my $sqldb = DBIx::SQLEngine->new('dbi:mysql:database=hg18','uname','pa +sswd'); my $refGenes1 = $sqldb->fetch_select( tables => {'refGene.name' => 'refLink.mrnaAcc'}, where => ['refGene.name like ?','NM_0002%']); my $refGenes = $db->fetch_select( tables => {'refGene.name' => 'refLink.mrnaAcc'}, where => ['refGene.name like ?','NM_0002%']);
From the debugger, I dump out the $db and $sqldb objects, which look like:
DB<3> x $sqldb 0 DBIx::SQLEngine::Driver::Mysql::V3_0=HASH(0x1a7c478) 'dbh' => DBI::db=HASH(0x1a28f78) empty hash 'package' => 'DBIx::SQLEngine::Driver' 'reconnector' => CODE(0x1a7c4a8) -> &DBIx::SQLEngine::Driver::__ANON__[/Library/Perl/5.8.1/DBIx/S +QLEngine/Driver.pm:252] in /Library/Perl/5.8.1/DBIx/SQLEngine/Driver. +pm:252-252 DB<4> x $db 0 Bio::DB::UCSC::DB=HASH(0x1a28f54) 'dbh' => DBI::db=HASH(0x15c1fb8) empty hash 'package' => 'DBIx::SQLEngine::Driver' 'reconnector' => CODE(0x1a29938) -> &DBIx::SQLEngine::Driver::__ANON__[/Library/Perl/5.8.1/DBIx/S +QLEngine/Driver.pm:252] in /Library/Perl/5.8.1/DBIx/SQLEngine/Driver. +pm:252-252
So, they look OK, but I get an error when I try to use the $db object:
main::(test.pl:16): my $refGenes = $db->fetch_select(tables => {'r +efGene.name' => 'refLink.mrnaAcc'}, main::(test.pl:17): where => ['re +fGene.name like ?','NM_0002%']); DB<1> Can't locate object method "fetch_select" via package "Bio::DB::UCSC:: +DB" at test.pl line 16. at test.pl line 16 Debugged program terminated. Use q to quit or R to restart,

Any hints are appreciated.

Thanks,
Sean


In reply to Inheritance confusion by srdst13

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.