christopherbarsuk has asked for the wisdom of the Perl Monks concerning the following question:
I'm attempting to create a package to handle/extend DBI functionality. I would love it if the following code would work as expected:
... however, it's not. The following code DOES work, but it's not exactly suiting my needs:package mydbh; @ISA = qw( DBI ); require DBI; use strict; sub new { my( $class, $dns, $username, $password ) = @_; my $self = DBI->connect( $dns, $username, $password ); return bless $self, $class||ref $class; }
Anybody out there know what's going on?package mydbh; @ISA = qw( DBI ); require DBI; use strict; sub new { my( $class, $dns, $username, $password ) = @_; my $ref = DBI->connect( $dns, $username, $password ); return bless { DBI => $ref }, $class||ref $class; }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: inheritance not working as expected
by bikeNomad (Priest) on Jul 03, 2001 at 19:50 UTC | |
Re: inheritance not working as expected
by converter (Priest) on Jul 03, 2001 at 19:56 UTC | |
Re: inheritance not working as expected
by pope (Friar) on Jul 03, 2001 at 20:02 UTC | |
Re: inheritance not working as expected
by bart (Canon) on Mar 03, 2011 at 12:25 UTC | |
by roboticus (Chancellor) on Mar 03, 2011 at 13:40 UTC | |
by jdporter (Paladin) on Mar 03, 2011 at 16:15 UTC |