Dan wrote: > Hi > > Is it possible to share variables between 2 perl scripts running as 2 > separate processes? I've looked on CPAN but can't see any names that are > obvious they do that kind of thing. > > Thanks in advance. > > Dan
use a simple share memory method such as IPC::ShareLite. example: #!/usr/bin/perl -w use strict; use IPC::ShareLite; #-- #-- server.pl #-- my $share = new IPC::ShareLite(-key => 1234, -create => 'yes', -destroy => 'yes' ) or die $!; $share->store("Stored by sm server"); while(1){sleep(10); print "Created sm 1234\n"} __END__ #!/usr/bin/perl -w use strict; use IPC::ShareLite; #-- #-- client.pl #-- my $share = new IPC::ShareLite(-key => 1234, -create => 'no', -destroy => 'no') or die $!; print "Get this from server: ",$share->fetch,"\n"; __END__ start server.pl first: [xx@panda]server.pl Created sm 1234 Created sm 1234 ... then test the sm client: [xx@panda]client.pl Get this from server: Stored by sm server share memory is a great method for sharing a piece of information between multiple processes especially if the information is small enough to fit in the RAM. i usually avoid pipes if i can with sm. i can't remember if the module handles samephor for you for not, if no, then you will have to make sure each process that access the information to sync up with each other. david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]