| 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
| |||||||||||||||||||||||||||||
| 26 | 44 | ▶ | if ( $args->{command} eq 'smoke' and !$args->{module} ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$args->{"command"} eq "smoke" and not $args->{"module"}
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"}
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 51 | 85 | return map { ( $_ => $self->$_ ) } @returns; | |||||||||||||||||||||||||||
| 52 | } | ||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||
| 54 | 24 | 1; | |||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||
| 56 | __END__ | ||||||||||||||||||||||||||||