Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

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

by westy032001 (Novice)
on Nov 08, 2010 at 18:03 UTC ( #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? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (1)
As of 2022-07-02 17:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My most frequent journeys are powered by:









    Results (103 votes). Check out past polls.

    Notices?