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

Esteemed monks,

I searched CPAN, but could not find what I need.
I'm looking for a module to which I could pass a sub ref and a number. That module would then fork that number of processes, which would execute the passed sub ref.
I need that module to restart a process with the same sub, should it die.

Ideally, this module would also allow me to modify the number of processes at runtime, a bit like Log::Log4perl's behavior can be changed on the fly by changing a configuration file.

Does anyone know if such a module exists ?

Thanks in advance for your wise advice.

Replies are listed 'Best First'.
Re: Looking for a 'watchdog' module
by robartes (Priest) on May 24, 2005 at 14:32 UTC

    A quick scan of CPAN reveals Parallel::ForkManager. This should go some ways towards your goal. You can implement the watchdog behaviour using the callbacks featured in that module, but a cursory glance at the docs does not reveal a way to modify the number of children during runtime, so I'm afraid this module might not help you there

    CU
    Robartes-

Re: Looking for a 'watchdog' module
by deibyz (Hermit) on May 24, 2005 at 15:37 UTC
    Don't know if can be what you need, but you can have a look at POE.
Re: Looking for a 'watchdog' module
by herveus (Prior) on May 24, 2005 at 17:27 UTC
    Howdy!

    Net::Server may also suffice, if you run in the pre-forking mode.

    yours,
    Michael