NAME

Parallel::Runner - An object to manage running things in parallel processes.

DESCRIPTION

There are several other modules to do this, you probably want one of them. This module exists as a super specialised parallel task manager. You create the object with a process limit and callbacks for what to do while waiting for a free process slot, as well as a callback for what a process should do just before exiting.

You must explicitly call $runner->finish() when you are done. If the runner is destroyed before it's children are finished a warning will be generated and your child processes will be killed, by force if necessary.

If you specify a maximum of 1 then no forking will occur, and run() will block until the coderef returns. You can force a fork by providing a boolean true value as the second argument to run(), this will force the runner to fork before running the coderef, however run() will still block until it the child exits.

SYNOPSYS

#!/usr/bin/perl
use strict;
use warnings;
use Parallel::Runner;

my $runner = Parallel::Runner->new(4);
$runner->run( sub { ... } );
$runner->run( sub { ... } );
$runner->run( sub { ... } );
$runner->run( sub { ... } );

# This will block until one of the previous 4 finishes
$runner->run( sub { ... } );

# Do not forget this.
$runner->finish;

CONSTRUCTOR

ACCESSORS

These are simple accessors, providing an argument sets the accessor to that argument, no argument it simply returns the current value.

OBJECT METHODS

FENNEC PROJECT

This module is part of the Fennec project. See Fennec for more details. Fennec is a project to develop an extendable and powerful testing framework. Together the tools that make up the Fennec framework provide a potent testing environment.

The tools provided by Fennec are also useful on their own. Sometimes a tool created for Fennec is useful outside the greater framework. Such tools are turned into their own projects. This is one such project.

AUTHORS

Chad Granum exodist7@gmail.com

COPYRIGHT

Copyright (C) 2010 Chad Granum

Parallel-Runner is free software; Standard perl licence.

Parallel-Runner is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the license for more details.