Ken, this is a great beginning. new_dbh is not a subclass though, it's a subroutine (or maybe my knowledge of the terms is off, I admit to being fairly new with packages). new_dbh is a subroutine in MyModule::Database
I can see how in the example given (thanks so much for this) where the differences are between ::db and ::st
If I setup a prepare subroutine in MyModule::Database then that would take precedence over DBI's prepare? I would just prefer than any solution not have me tracking down every $sth in our codebase and fix it (which your example helps with greatly) or having to re-code the entire MyModule::Database module to a separation of ::db and ::st
......or do I need to just setup a subclass like this...
package MyModule::Database::db;
use vars qw(@ISA);
@ISA = qw(DBI::db);
sub prepare {
my ($dbh, @args) = @_;
my $sth = $dbh->SUPER::prepare(@args)
or return;
$sth->{private_mysubdbi_info} = { foo => 'bar' };
return $sth;
}
I understand my question might not even make sense. I do enjoy this the more I learn it.