File Coverage

blib/lib/Eixo/Zone/Resume.pm
Criterion Covered Total %
statement 13 21 61.9
branch 3 8 37.5
condition 0 2 0.0
subroutine 4 8 50.0
pod 0 7 0.0
total 20 46 43.4


line stmt bran cond sub pod time code
1             package Eixo::Zone::Resume;
2              
3 4     4   4853 use strict;
  4         7  
  4         1342  
4              
5             sub new{
6              
7 2     2 0 1106 return bless({
8              
9             pid=>$_[1],
10              
11             __batchs=>[],
12              
13             __artifacts=>[],
14              
15             });
16             }
17              
18             sub artifacts{
19              
20 0   0 0 0 0 my $a = $_[0]->{__artifacts} || [];
21              
22 0 0       0 wantarray ? @$a : $a;
23              
24             }
25              
26              
27             sub batch{
28              
29 0     0 0 0 $_->() foreach(@{$_[0]->{__batchs}});
  0         0  
30              
31 0         0 $_[0];
32             }
33              
34             sub addBatch{
35              
36 0     0 0 0 push @{$_[0]->{__batchs}}, $_[1];
  0         0  
37              
38             }
39              
40             sub addArtifact{
41              
42 1     1 0 5 push @{$_[0]->{__artifacts}}, $_[1];
  1         7  
43             }
44              
45             sub getPSInit{
46              
47 0     0 0 0 my $ps_init = $_[0]->getArtifacts(
48              
49             type=>"Eixo::Zone::Artifact::PSInit"
50             );
51              
52             }
53              
54             sub getArtifacts{
55 1     1 0 8 my ($self, %args) = @_;
56              
57 1         1 my @artifacts = @{$_[0]->{__artifacts}};
  1         3  
58              
59 1 50       4 if(my $t = $args{type}){
60              
61             @artifacts = grep {
62              
63 1         1 $_->isa($t)
  1         10  
64              
65             } @artifacts;
66             }
67              
68 1 50       12 wantarray ? @artifacts :
    50          
69              
70             (@artifacts > 1) ? \@artifacts :
71              
72             $artifacts[0];
73             }
74              
75             1;