SmokeBox/Job.pm

filter: Statementstmt 91.8% 34 / 37 Branchbran 66.6% 4 / 6 Conditioncond 66.6% 2 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 90.0% 9 / 10 Podpod 100% 2 / 2 totaltotal 85.0% 51 / 60 CC 6 SCAR 9.9
CC
6
Cov
87%
new
5.5
__ANON__
2.0
dump_data
2.0
CRAP 2.7
« SmokeBox/Smoker.pm ↑ Summary SmokeBox/Result.pm »
1 package POE::Component::SmokeBox::Job;
2 24 $POE::Component::SmokeBox::Job::VERSION = '0.58';
3 #ABSTRACT: Object defining a SmokeBox job.
4  
5 24 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 24 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 24 ▶use Params::Check qw(check);
Subroutine BEGIN: called CC=1 SCAR=0.0
8 24 ▶use base qw(Object::Accessor);
Subroutine BEGIN: called CC=1 SCAR=0.0
9 24 ▶use vars qw($VERBOSE);
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 44 ▶sub new {
Subroutine new: called CC=5 SCAR=17.1
Pod documented
12 44 my $package = shift;
13  
14 44 my $tmpl = {
15 idle => { allow => qr/^\d+$/, default => 600, },
16 timeout => { allow => qr/^\d+$/, default => 3600, },
17 type => { defined => 1, default => 'CPANPLUS::YACSmoke', },
18 command => { allow => [ qw(check index smoke) ], default => 'check', },
19 module => { defined => 1 },
20 no_log => { defined => 1, allow => qr/^(?:0|1)$/, default => 0, },
21 delay => { defined => 1, allow => qr/^\d+$/, default => 0, },
22 check_warnings => { defined => 1, allow => qr/^(?:0|1)$/, default => 1, },
23 };
24  
25 44 ▶ my $args = check( $tmpl, { @_ }, 1 ) or return;
Branch: 1 branch
BranchTrueFalseTotal
my $args = check($tmpl, {@_}, 1) or return 44 0 44
26 44 ▶ if ( $args->{command} eq 'smoke' and !$args->{module} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($args->{"command"} eq "smoke" and not $args->{"module"}) 0 44 44
Condition66%2/3
$args->{"command"} eq "smoke" and not $args->{"module"}
!ll&&!rl&&r
19250
MC/DC0%0/2
$args->{"command"} eq "smoke" and not $args->{"module"}
$args->{"command"} eq "smoke" not $args->{"module"}
Truth table66%2/3
A and not(B)
A= $args->{"command"} eq "smoke"B= not $args->{"module"}
ABresult
0X0
100
111
27 0 warn "${package}::new expects 'module' to be set when command is 'smoke'";
28 0 return;
29 }
30 44 my $self = bless { }, $package;
31 my $accessor_map = {
32 idle => qr/^\d+$/,
33 timeout => qr/^\d+$/,
34 44 ▶ type => sub { defined $_[0]; },
Subroutine __ANON__: called CC=1 SCAR=0.0
35 command => [ qw(check index smoke) ],
36 25 ▶ module => sub { defined $_[0]; },
Subroutine __ANON__: called CC=1 SCAR=0.0
37 0 ▶ id => sub { defined $_[0]; },
Subroutine __ANON__: not called CC=1 SCAR=6.9
38 44 no_log => qr/^(?:0|1)$/,
39 delay => qr/^\d+$/,
40 check_warnings => qr/^(?:0|1)$/,
41 };
42 44 $self->mk_accessors( $accessor_map );
43 44 $self->$_( $args->{$_} ) for keys %{ $args };
44 44 return $self;
45 }
46  
47 85 ▶sub dump_data {
Subroutine dump_data: called CC=2 SCAR=6.9
Pod documented
48 85 my $self = shift;
49 85 my @returns = qw(idle timeout type command no_log check_warnings);
50 85 ▶ push @returns, 'module' if $self->command() eq 'smoke';
Branch: 1 branch
BranchTrueFalseTotal
if $self->command eq "smoke" 25 60 85
51 85 return map { ( $_ => $self->$_ ) } @returns;
52 }
53  
54 24 1;
55  
56 __END__
« SmokeBox/Smoker.pm ↑ Summary SmokeBox/Result.pm »