Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: to "use vars" or not to

by Corion (Patriarch)
on Nov 08, 2010 at 17:37 UTC ( [id://870158]=note: print w/replies, xml ) Need Help??


in reply to to "use vars" or not to

No. That's not how fork works.

use vars; creates a global variable and its value gets copied into every child spawned by fork. Usually, mixing fork and DBI is a bad idea unless you read the DBI documentation closely. I recommend you do that.

Using global variables always creates the possibility of action at a (long) distance, so restricting the scope of variables is a good approach to reducing the distance over which action can influence the values. our won't help much because it still creates global variables that can be changed from elsewhere. If you want more protection, consider using lexical variables, as declared with my.

If you want more concrete help, post concrete code that exhibits your problem. It should not be longer than 20 lines and not require outside data files.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://870158]
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: (6)
As of 2024-04-19 10:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found