ThelmaJay has asked for the wisdom of the Perl Monks concerning the following question:
Dear Masters,
how can I share the same group of functions with different processes without having make copies of the same code.
Imagine I have a file printVar.pl with the content:
sub setVarValue{ ($inputVal) = @_; $v = $inputVal; return $v } 1;
and two processes:
Main one.pl
require 'C:\Users\Administrator\workspace\GPSTracker\lib\printVar.pl'; while(1){ $newVal = setVarValue(1); print "MAIN ONE - NEW VAL = $newVal\n"; } 1;
Main Two.pl
require 'C:\Users\Administrator\workspace\GPSTracker\lib\printVar.pl'; while(1){ $newVal = setVarValue(2); print "MAIN TWO - NEW VAL = $newVal\n"; } 1;
Now I would like to run both processes at the same time.But when I run one first the other blocks.
Is there a way to share resources between processes without interference
.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How to share a group of functions with multiple main processes?
by hippo (Archbishop) on Nov 19, 2013 at 17:36 UTC | |
|
Re: How to share a group of functions with multiple main processes?
by Eily (Monsignor) on Nov 19, 2013 at 17:45 UTC | |
|
Re: How to share a group of functions with multiple main processes?
by Laurent_R (Canon) on Nov 19, 2013 at 17:52 UTC | |
|
Re: How to share a group of functions with multiple main processes?
by RichardK (Parson) on Nov 19, 2013 at 18:59 UTC | |
|
Re: How to share a group of functions with multiple main processes?
by ThelmaJay (Novice) on Nov 23, 2013 at 16:26 UTC |