Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Fork accessing global variables?

by devslashneil (Friar)
on Feb 20, 2004 at 03:20 UTC ( [id://330439]=perlquestion: print w/replies, xml ) Need Help??

devslashneil has asked for the wisdom of the Perl Monks concerning the following question:

Hey Monks,
I was wondering if it was possible to fork off a section of code, i.e make it run independent to the rest of the script, whilst still giving it access to the global variables the script has?

I need my script to sit waiting for connections using NetServer::Generic, whilst in the background waiting for messages, and pushing them to the appropriate client by calling a series of callbacks (subroutine references) stored in a global hash assorted with the username.

To be honest i'm not even sure if i'm going about this the right way, i think what i need to do is sort of outside the bounds of NetServer::Generic, but i'd really like to avoid rewriting my existing code without this module as i don't have the time.

Any help would be much appreciated

Neil Archibald
Games on Demand

Replies are listed 'Best First'.
Re: Fork accessing global variables?
by ysth (Canon) on Feb 20, 2004 at 05:59 UTC
    The variables you need to share can be tied with IPC::Shareable, which see.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://330439]
Approved by jweed
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (5)
As of 2024-03-29 15:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found