NAME

Win32::ProcFarm::PerpetualPool - manages a pool of child processes for perpetual jobs

SYNOPSIS

        use Win32::ProcFarm::PerpetualPool;

        $Pool = Win32::ProcFarm::PerpetualPool->new($poolsize, $portnum, $scriptname, Win32::GetCwd,
                command => 'whatever',
                list_check_intvl => 30,
                exit_check_intvl => 5,
                list_sub => sub { return ('Fred', 'Julie', 'Joe') },
                exit_sub => sub { return -e 'killme'; },
                result_sub => sub { print join(', ' @_)."\n"; },
        );

        $Pool->start_pool(0.1);

DESCRIPTION

Installation instructions

This installs with MakeMaker as part of Win32::ProcFarm.

To install via MakeMaker, it's the usual procedure - download from CPAN, extract, type "perl Makefile.PL", "nmake" then "nmake install". Don't do an "nmake test" because the I haven't written a test suite yet.

More usage instructions

This is a version of Win32::ProcFarm::Pool designed for continuous operation. You supply a single command name and a subroutine that returns a list of keys. The keys are passed as the sole parameter to the command (it is presumed that the child process can do whatever needs to be done based on that single key). The subroutine that returns the list of keys will be periodically executed (every 120 seconds by default, but adjustable via list_intvl) and the running list updated as needed. Whenever a job finishes, that key is added back onto the end of the waiting pool.

METHODS