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

Re^2: to "use vars" or not to

by westy032001 (Novice)
on Nov 08, 2010 at 18:03 UTC ( [id://870162]=note: print w/replies, xml ) Need Help??


in reply to Re: to "use vars" or not to
in thread to "use vars" or not to

Thank you for your quick response .

All of my DBI code exists in the module run by the child forked from the listener and so I dont intend to share a connection, but by setting the $dbh globaly in the module run by the child am i causing it to be inherited by the next forked child ?

thanks.

Replies are listed 'Best First'.
Re^3: to "use vars" or not to
by Corion (Patriarch) on Nov 08, 2010 at 18:11 UTC

    You seem to be unclear about what fork does, in Perl and on many operating systems. See Fork (operating system) for a more general introduction. If you are on Windows, it's best to avoid fork overall, especially when trying to use DBI.

      Thanks again for the reply and link.

      So to summarize, creating a global (via use vars) $dbh database handle in a module called from a forked child cannot impact another forked child because the child is a copy of the parent prior to the creation of the $dbh. ?

      hopefully thats right ? cheers.
        Right. If the dbh was created before forking, that would be another story.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://870162]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (5)
As of 2024-04-24 00:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found