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

Hi all,

I currently have the following workflow in place :

The problem I'm facing is that the child, following the inner working of fork, gets the memory copied from the parent, and the subsequent perl modules initialy loaded by the server.

However said modules can be updated from time to time, but the loaded copy of the modules are not refreshed so the child always ends up with the older modules even though the modules have been updated on disk.

I understand that this behaviour is standard and expected but it doesn't suits my needs, so I'm seeking some information or pointers on the best way to achieve the following :

I tried to use Module::Reload but given the complexity of modules being loaded I always ended up generating infinite loops and i'm sure i need that.

It seems that using pipes might help, but not quite sure about that or how to implement it.

Thanks for your help and tips on the best way to achieve that.

Best, M

  • Comment on Server launching external process without copying memory

Replies are listed 'Best First'.
Re: Server launching external process without copying memory
by Corion (Patriarch) on Jan 05, 2018 at 11:10 UTC

    Why not launch the "child" simply as a separate process through either fork+exec or just system, depending on your OS?

    That way, it would be trivial and obvious that the child runs with the latest of the greatest of modules.

    You will need to arrange for the transfer of the payload to the child somehow, but most likely a temporary file or something like that will be enough.

      Thanks Corion, I'm going to try that solution. Best,M