NAME
   Parallel::Scoreboard - a scoreboard for monitoring status of many
   workers

SYNOPSIS
     use Parallel::Scoreboard;

     my $scoreboard = Parallel::Scoreboard->new(
         base_dir => '/tmp/my_scoreboard'
     ...

     # in each worker process
     $scoreboard->update('this is my current status');

     # to read status of all worker processes
     my $stats = $scoreboard->read_all();
     for my $pid (sort { $a <=> $b } keys %$stats) {
         print "status for pid:$pid is: ", $stats->{$pid}, "\n";
     }

DESCRIPTION
   Parallel::Scoreboard is a pure-perl implementation of a process
   scoreboard. By using the module it is easy to create a monitor for many
   worker process, like the status module of the Apache HTTP server.

   Unlike other similar modules, Parallel::Scoreboard is easy to use and
   has no limitation on the format or the length of the statuses to be
   stored. Any arbitrary data (like JSON or frozen perl object) can be
   saved by the worker processes as their status and read from the manager
   process.

METHODS
 new(%args)
   instantiation. Recognizes the following paramaters. The parameters can
   be read using the read-only accessors with the same name.

  base_dir => $base_dir
   the directory name in which the scoreboard files will be stored. The
   directory will be created if it does not exist already. Mandatory
   parameter.

  worker_id => sub { ... }
   a subref that returns the id of the worker (if omitted, the module uses
   $$ (process id) to distinguish between the workers)

 update($status)
   saves the status of the process

 read_all()
   reads the status of all worker processes that are alive and that have
   called update() more than once. Returned value is a hashref with process
   ids as keys and the statuses of each processes as corresponding values.

 cleanup()
   remove obsolete status files found in base_dir. The files are normally
   removed upon the termination of worker process, however they might be
   left unremoved if the worker process was killed for some reason. The
   detection and removal of the obsolete status files is performed by
   read_all() as well.

SEE ALSO
   IPC::ScoreBoard Proc::Scoreboard

AUTHOR
   Kazuho Oku <kazuhooku gmail.com>

LICENSE
   This program is free software, you can redistribute it and/or modify it
   under the same terms as Perl 5.10.