Think about Loose Coupling | |
PerlMonks |
Re: to "use vars" or not toby Corion (Patriarch) |
on Nov 08, 2010 at 17:37 UTC ( [id://870158]=note: print w/replies, xml ) | Need Help?? |
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.
In Section
Seekers of Perl Wisdom
|
|