westy032001 has asked for the wisdom of the Perl Monks concerning the following question:
Scenario is. I have a process listening which when it receives an input it forks and runs a module which inputs the data into a database.
In this module (package name DB_input ) i have used “use vars qw($dbh $timestamp $server)" . I am occasionally having mangled data go into the database and i wonder if it is because of the “use vars” ? Is it possible that when the listener forks 2 or more children at the same time, that the variables defined by “use vars” can end up being shared between the forked children ?
In which case would using "our" be better as i understand it is more tightly scoped ? thank you .
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: to "use vars" or not to
by Corion (Patriarch) on Nov 08, 2010 at 17:37 UTC | |
|
Re: to "use vars" or not to
by ikegami (Patriarch) on Nov 08, 2010 at 17:40 UTC | |
by westy032001 (Novice) on Nov 08, 2010 at 18:03 UTC | |
by Corion (Patriarch) on Nov 08, 2010 at 18:11 UTC | |
by westy032001 (Novice) on Nov 08, 2010 at 19:14 UTC | |
by ikegami (Patriarch) on Nov 08, 2010 at 20:34 UTC | |
|
Re: to "use vars" or not to
by locked_user sundialsvc4 (Abbot) on Nov 08, 2010 at 21:45 UTC | |
|
Re: to "use vars" or not to
by 7stud (Deacon) on Nov 08, 2010 at 21:51 UTC |