@ISA = qw(DBI) no worky part II

Bob Kleemann rkleeman at energoncube.net
Wed Feb 27 11:47:34 CST 2002


~sdpm~
Just because you use a module doesn't mean you aren't doing inheritance. 
It just says you are loading the module into memory.  After that you can
either use it in the normal fashion (via a something like my $dbh =
DBI->connect(...)) or you can inherit from it. 

package Bar;

use DBI qw();

@ISA = qw(Foo DBI);

On Wed, 27 Feb 2002, Chuck Phillips wrote:

> But then I'm not inheriting from DBI, I'm using it.
> 
> > From: Bob Kleemann <rkleeman at energoncube.net>
> > Date: Wed, 27 Feb 2002 09:37:47 -0800 (PST)
> > To: Chuck Phillips <chuckphillips at mac.com>
> > Cc: Perl Mongers <san-diego-pm-list at happyfunball.pm.org>
> > Subject: Re: @ISA = qw(DBI) no worky part II
> > 
> > Did you try adding a "use DBI;" into package Bar?
> > 
> > On Wed, 27 Feb 2002, Chuck Phillips wrote:
> > 
> >> ~sdpm~
> >> Sorry, hit some key combo that sent the message before I was ready.... Let's
> >> try this again.
> >> 
> >> Hello All,
> >> 
> >> I'm trying to write a package that inherits from DBI, but am missing
> >> something. Running the following test script gives me the following:
> >> 
> >> Can't locate object method "connect" via package "Bar" at ./test.pl line 12.
> >> 
> >> Any help would be appreciated.
> >> 
> >> -Chuck
> >> 
> >> # Code below
> >> package Foo;
> >> sub connect2 { my ($self, $name) = @_; print "FOO BAR $name\n"; bless {},
> >> $self; };
> >> sub bar { print "hi\n"; }
> >> 
> >> package Bar;
> >> @ISA = qw(Foo DBI);
> >> sub foo { print "there.\n"; };
> >> 
> >> package main;
> >> my $a = Bar->connect("dbi:mysql:test:localhost",'root','foo');
> >> $a->bar;
> >> $a->foo;
> >> 
> >> ~sdpm~
> >> 
> >> The posting address is: san-diego-pm-list at hfb.pm.org
> >> 
> >> List requests should be sent to: majordomo at hfb.pm.org
> >> 
> >> If you ever want to remove yourself from this mailing list,
> >> you can send mail to <majordomo at happyfunball.pm.org> with the following
> >> command in the body of your email message:
> >> 
> >>     unsubscribe san-diego-pm-list
> >> 
> >> If you ever need to get in contact with the owner of the list,
> >> (if you have trouble unsubscribing, or have questions about the
> >> list itself) send email to <owner-san-diego-pm-list at happyfunball.pm.org> .
> >> This is the general rule for most mailing lists when you need
> >> to contact a human.
> >> 
> >> 
> > 
> > 
> 
> 

~sdpm~

The posting address is: san-diego-pm-list at hfb.pm.org

List requests should be sent to: majordomo at hfb.pm.org

If you ever want to remove yourself from this mailing list,
you can send mail to <majordomo at happyfunball.pm.org> with the following
command in the body of your email message:

    unsubscribe san-diego-pm-list

If you ever need to get in contact with the owner of the list,
(if you have trouble unsubscribing, or have questions about the
list itself) send email to <owner-san-diego-pm-list at happyfunball.pm.org> .
This is the general rule for most mailing lists when you need
to contact a human.




More information about the San-Diego-pm mailing list