I have seen this doc: http://search.cpan.org/~bsugars/IPC-Shareable-0.60/lib/IPC/Shareable.pm I'm interested in using the IPC::Shareable module.Does this method suit for my situation?Because there are so many socket requests coming into my socket program on everytime,when each request coming,I fork a child process to handle it.And,where in child process,I tie and lock the global variable %hash and do motification to it.Since the actions of 'fork' and 'tie' happen so frequently,is there any performance drawback to the program?thanks again.
-----Original Message----- >From: Jeff Pang <[EMAIL PROTECTED]> >Sent: Jan 30, 2006 2:38 PM >To: beginners@perl.org >Subject: how to share variable across multi-processes > >hello,lists, > >I have a hash var in my script,and I want to get it be shared across >multi-processes.Fox example: > >my %hash; > >while(1) >{ > die "can't fork:$!" unless defined (my $child = fork()); > > if ($child==0) > { > do_something_to_hash(); # here I need to do some operations to the > %hash,which is defined globally.These operations include add something to > %hash,or do modification or 'delete' to %hash. > } >} > >Is there any suggestion or document can help me to do that?thanks. > >-- >http://home.earthlink.net/~pangj/ > >-- >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] ><http://learn.perl.org/> <http://learn.perl.org/first-response> > > -- http://home.earthlink.net/~pangj/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>