#!/usr/bin/perl # Sample program for the simple worker pool. # Runs a number of parallel tasks. # Copyright 2004 by Rocco Caputo. Free software. # Same terms as Perl itself. Have fun! use warnings; use strict; use Worker; use WorkerPool; my $jobs_remaining = 20; WorkerPool->spawn( max_parallel => 10, job_fetcher => \&fetch_another_job, ); POE::Kernel->run(); exit 0; sub fetch_another_job { return unless $jobs_remaining; $jobs_remaining--; return { worker_class => "Worker", sleep_period => rand(5), }; }