NAME

IPC::QWorker - Perl extension for processing a queue in parallel

SYNOPSIS

  my $qworker = IPC::QWorker->new();
  
  $qworker->create_workers(10,
          'dump' => sub { my $ctx = shift();
  							print $$.": ".Dumper(@_)."\n";
  							 $ctx->{'count'}++; },
          '_init' => sub { my $ctx = shift();	
  							$ctx->{'count'} = 0 ; },
          '_destroy' => sub { my $ctx = shift();
  							print $$.": did ".$ctx->{'count'}." operations!\n"; }
  );
          
  foreach $i (1..120) {
          $qworker->push_queue(IPC::QWorker::WorkUnit->new(
                  'cmd' => 'dump',
                  'params' => $i,
          ));
  }
  
  $qworker->process_queue();

	# wait till queue is emtpy
  $qworker->flush_queue();
	# then stop all workers
  $qworker->stop_workers();

ABSTRACT

This Module creates a group of child processes and feeds them with data
from a queue.

DESCRIPTION

With this module you can fork a few child processes which know a few
function calls you define while creating them.
Later you can pass command with parameters into the queue which is
distributed across the child processes thru pipes(with the Storable module).

EXPORT

None by default.

SEE ALSO

perl, POSIX, Storable, IO::Select

AUTHOR

Markus Benning, <me@w3r3wolf.de>

COPYRIGHT AND LICENSE

Copyright 2013 by Markus Benning <me@w3r3wolf.de>

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.