[ABE.pm] And another thing...
Faber J. Fedor
faber at linuxnj.com
Wed May 17 17:15:08 PDT 2006
How do I pass a variable from the superclass to the subclass? Nothing
I've tried works.
Specifically, I want to make a DB connection in my superclass which all
of the subclasses would use (ideally, it should be the same connection
for all subclasses, but that's a nicetie right now). One ofthe simplest
things I've done in my superclass is this:
$dbh = connectToDB();
sub dbh { return $dbh; }
and in my subclass, I've tried
print "in subclass, dbh is ". $dbh ."\n";
print "in subclass, dbh is ". dbh() ."\n";
print "in subclass, dbh is ". $self->dbh() ."\n";
print "in subclass, dbh is ". $self->{dbh} ."\n";
print "in subclass, dbh is ". $self->SUPER::dbh() ."\n";
and numerous other things but I get various errors at the print
statement.
How is this thing supposed to work?
--
Regards,
Faber Fedor
President
Linux New Jersey, Inc.
908-320-0357
800-706-0701
http://www.linuxnj.com
More information about the ABE-pm
mailing list