File Coverage

blib/lib/Proc/tored/Pool.pm
Criterion Covered Total %
statement 26 28 92.8
branch n/a
condition n/a
subroutine 11 13 84.6
pod 7 7 100.0
total 44 48 91.6


line stmt bran cond sub pod time code
1             package Proc::tored::Pool;
2             # ABSTRACT: managed work pool with Proc::tored and Parallel::ForkManager
3             $Proc::tored::Pool::VERSION = '0.07';
4              
5 13     13   2010177 use strict;
  13         13  
  13         338  
6 13     13   52 use warnings;
  13         13  
  13         468  
7             require Exporter;
8 13     13   4173 use Proc::tored::Pool::Constants ':events';
  13         13  
  13         1703  
9 13     13   4459 use Proc::tored::Pool::Manager;
  13         65  
  13         364  
10 13     13   5681 use Proc::tored;
  13         4667  
  13         1066  
11              
12 13     13   65 use parent 'Exporter';
  13         13  
  13         52  
13              
14             our @EXPORT = (
15             @Proc::tored::EXPORT,
16             qw(
17             assignment
18             success
19             failure
20             pool
21             capacity
22             on
23             call
24             pending
25             process
26             )
27             );
28              
29              
30 13     13 1 221 sub pool ($%) { Proc::tored::Pool::Manager->new(name => shift, @_); }
31 13     13 1 234 sub capacity ($@) { workers => shift, @_ }
32 39     39 1 156 sub on ($@) { 'on_' . shift, @_ }
33 39     39 1 12506 sub call (&@) { @_ }
34 0     0 1 0 sub pending ($) { $_[0]->pending }
35 0     0 1 0 sub sync ($) { $_[0]->sync }
36              
37             sub process (&$;$) {
38 90     90 1 775809 my $code = shift;
39 90         175 my $pool = shift;
40 90         207 unshift @_, $code;
41 90         586 $pool->assign(@_);
42             }
43              
44             1;
45              
46             __END__