> > I'm planning on inheriting from DBI::db.
> >
> > My question is, is it safe to inherit from DBI::db?
>
> From: Mitch Helle-Morrissey [mailto:[EMAIL PROTECTED]]
>
> Look at the subclass.t test file that comes with the DBI
> distribution. In
> short, you'll need to inherit from all three DBI classes:
> DBI, DBI::db, and
> DBI::st. You'll need to use the init_rootclass() method so
> your constructor
> returns an object of the type you created instead of a DBI::db object.
>
> I've written a subclass which works fine.
>
> Mitch
Interesting! I guess it's not documented yet because it's still
experimental?
Is this really necessary, though? Why can't I just say:
--------------
package MyDBI;
MyDBI::ISA = qw(DBI::db);
sub connect {
my $class = shift;
my $dbh = SUPER::connect(@_);
bless $dbh, $class;
$dbh->do_other_fancy_things;
return $dbh;
}
sub do_other_fancy_things {
# highly secret and exciting code not yet written
}
---------------
Then, it seems to me, for everything except connect, the regular DBI stuff
will happen, right? I'm a bit wary of using the init_rootclass since
(a) others may be using my code for Important Things, and (b) subclass.t
says, "This whole mechanism is new and experimental - it may change!"
Amir Karger
Curagen Corporation