Big thanks to everyone who provided suggestions, advice - and warnings!
Special thanks to aufflick and jZed. jZed pointed out that it was DBI::db which I needed to override ( I had been working directly under DBI, which wasn't working ). aufflick showed quite succinctly how to achieve exactly what I was asking.
In my "Foo.pm" class:
{ package DBI::db; sub dbq { my $self = shift; my $sql = shift; my ( $sth ); $sth = $self->prepare( $sql ); $sth->execute; return $sth; } }
Works like a charm!
Now I can hand-off $foo->get_dbh to other classes, which are then able to $dbh->dbq( "blah" ) just as they were before -- no need for me to modify a ton of scripts and modules to subclass and/or change behavior.
Thanks again everyone,
Beers!
In reply to Re: object method question
by Zarathustra
in thread object method question
by Zarathustra
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |