[Melbourne-pm] Subclassing DBI

Serg B. serg.belokamen at gmail.com
Sat Feb 11 18:21:41 PST 2006


Hi All, 


I am trying to extend DBI or subclass it, what ever the term is...

Base example is;
>>> START <<<
package TestLib::DBConn;

use DBI();

our @ISA = qw(DBI);

sub myConnect
{
	my ($self, $db_type, $db_name, $db_user, $db_pass, $db_host, $db_port) = @_;

	my $dsn = qq/DBI:$db_type:database=$db_name;host=$db_host;port=$db_port/;

	$self->connect($dsn, $db_user, $db_pass);

	...
>>> END <<<

When I run the driver that uses TestLib::DBConn I get an error:

DBI subclasses 'TestLib::DBConn::db' and ::st are not setup, RootClass
ignored at ./test.pl line 98


Any ideas as to how I could fix this?

   Thanks,
      Serg



More information about the Melbourne-pm mailing list