in reply to Adding code to a Perl program without stopping it

If you're running on Unix, you can send a signal (kill) which your process catches. The signal handler reads a file which contains a list of modules and versions which should be loaded, and compares those with what actually is loaded, and loads / reloads the missing ones.

On the other hand, loading your whiz-bang "Divide-by-zero" module is little benefit if there are no calls to it.

As Occam said: Entia non sunt multiplicanda praeter necessitatem.

  • Comment on Re: Adding code to a Perl program without stopping it

Replies are listed 'Best First'.
Re^2: Adding code to a Perl program without stopping it
by GrandFather (Saint) on Mar 27, 2011 at 20:04 UTC
    if there are no calls to it

    which is why when you use the delete $INC{...}/require technique you generally either only update a set of known volotile modules, or you use a registration processes with a known entry point in the modules.

    I use the registration technique to add new task handlers to a distributed task handling system that provides automated build and testing services. It allows me to add or correct task handlers without restarting (currently) six systems.

    True laziness is hard work