Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Perl forked processes and variable sharing

by LanX (Saint)
on Feb 01, 2022 at 21:52 UTC ( [id://11141025]=note: print w/replies, xml ) Need Help??


in reply to Perl forked processes and variable sharing

Pardon me for not looking into your code ...

... but AFAIK there shouldn't be any way that a process can change data inside another process.

And that is what fork is doing, creating different processes!

(however in a very efficient way by duplicating code with copy-on-write tricks, IIRC)

The "identical reference" you are seeing is IMHO just an identical copy of the reference, NOT the same memory address (NB: refs are not memory addresses! )

Why don't you use proper perlipc or threads with shared data instead?

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery

  • Comment on Re: Perl forked processes and variable sharing

Replies are listed 'Best First'.
Re^2: Perl forked processes and variable sharing
by fireblood (Scribe) on Feb 02, 2022 at 00:59 UTC
    Hi Rolf,

    Thanks for the feedback, and especially for your last line suggesting using proper perlipc or threads with shared data. I was aware of threads with shared data, but had not read Tom Christiansen's amazing treatise on Perl IPC until reading your reply. It's definitely got me going in a new direction that I think will work properly for me.

    Cheers, Richard

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (None)
    As of 2024-04-25 01:41 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      No recent polls found