Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Passing DBI database handles

by ido50 (Scribe)
on Dec 28, 2004 at 16:56 UTC ( #417791=perlquestion: print w/ replies, xml ) Need Help??
ido50 has asked for the wisdom of the Perl Monks concerning the following question:

Hi there!
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?
Thanks.

-------------------------
Live fat, die young

Comment on Passing DBI database handles
Select or Download Code
Re: Passing DBI database handles
by steves (Curate) on Dec 28, 2004 at 17:01 UTC

    Code doesn't matter much here

    Actually, it probably does matter. Can we see the code that's failing? Your basic approach should work, so it's probably a coding detail.

Re: Passing DBI database handles
by cchampion (Curate) on Dec 28, 2004 at 17:12 UTC
Re: Passing DBI database handles
by ido50 (Scribe) on Dec 29, 2004 at 18:40 UTC
    My bad guys... a disconnect statement was hiding in the code... Feel all newbie........

    -------------------------
    Live fat, die young

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://417791]
Approved by thor
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (12)
As of 2014-10-20 22:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (92 votes), past polls