|Think about Loose Coupling|
Passing DBI database handlesby ido50 (Scribe)
|on Dec 28, 2004 at 16:56 UTC||Need Help??|
ido50 has asked for the
wisdom of the Perl Monks concerning the following question:
Let's say I have a package called 'PacA'. On PacA I create a database handle (And connect to the database) called $PacA::dbh, using the DBI module. Now let's say PacA uses a module called 'PacA::Test', which performes operations on the database via $PacA::dbh. When trying to do so, I get an error message saying the database has gone away, or in my case 'MySQL has gone away'.
Code doesn't matter much here, could be something like (On PacA::Test of course) my $sth = $PacA::dbh->prepare("SELECT * FROM table"); $sth->execute.
What have I missed?
Live fat, die young