blib/lib/POE/Component/CPANPLUS/YACSmoke.pm

filter: Statementstmt 52.4% 204 / 389 Branchbran 38.8% 73 / 188 Conditioncond 23.3% 29 / 124 MC/DCmcdc 1.5% 1 / 65 Subroutinesub 46.6% 21 / 45 Podpod 100% 10 / 10 totaltotal 41.1% 338 / 821 CC 147 SCAR 55.3
CC
147
Cov
44%
_command
684.9
_wheel_kill
182.0
spawn
21.5
CRAP 251.4
↑ Summary
1 package POE::Component::CPANPLUS::YACSmoke;
2 12 $POE::Component::CPANPLUS::YACSmoke::VERSION = '1.64';
3 #ABSTRACT: Bringing the power of POE to CPAN smoke testing.
4  
5 12 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 12 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 12 ▶use POE qw(Wheel::Run);
Subroutine BEGIN: called CC=1 SCAR=0.0
8 12 ▶use Storable;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 12 ▶use Digest::MD5 qw(md5_hex);
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 12 my $GOT_KILLFAM;
12 my $GOT_PTY;
13  
14 12 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
15 12 $GOT_KILLFAM = 0;
16 12 eval {
17 12 require Proc::ProcessTable;
18 0 $GOT_KILLFAM = 1;
19 };
20 12 $GOT_PTY = 0;
21 12 eval {
22 12 require IO::Pty;
23 12 $GOT_PTY = 1;
24 };
25 }
26  
27 11 ▶sub spawn {
Subroutine spawn: called CC=7 SCAR=30.7
Pod documented
28 11 my $package = shift;
29 11 my %opts = @_;
30 11 $opts{lc $_} = delete $opts{$_} for keys %opts;
31 11 my $options = delete $opts{options};
32  
33 11 ▶ if ( $^O eq 'MSWin32' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($^O eq "MSWin32") 0 11 11
34 0 eval { require Win32; };
35 0 ▶ if ($@) { die "Win32 but failed to load:\n$@" }
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 0 0
36 0 eval { require Win32::Job; };
37 0 ▶ if ($@) { die "Win32::Job but failed to load:\n$@" }
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 0 0
38 0 eval { require Win32::Process; };
39 0 ▶ if ($@) { die "Win32::Process but failed to load:\n$@" }
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 0 0
40 }
41  
42 11 my $self = bless \%opts, $package;
43 11 ▶ $self->{session_id} = POE::Session->create(
Branch: 1 branch
BranchTrueFalseTotal
ref $options eq 'HASH' ? : 11 0 11
44 object_states => [
45 $self => { shutdown => '_shutdown',
46 submit => '_command',
47 push => '_command',
48 unshift => '_command',
49 recent => '_command',
50 check => '_command',
51 indices => '_command',
52 author => '_command',
53 flush => '_command',
54 'package' => '_command',
55 },
56 $self => [ qw(_start _spawn_wheel _wheel_error _wheel_closed _wheel_stdout _wheel_stderr _wheel_idle _wheel_kill _sig_child _sig_handle) ],
57 ],
58 heap => $self,
59 ( ref($options) eq 'HASH' ? ( options => $options ) : () ),
60 )->ID();
61 11 return $self;
62 }
63  
64 0 ▶sub session_id {
Subroutine session_id: not called CC=1 SCAR=6.9
Pod documented
65 0 return $_[0]->{session_id};
66 }
67  
68 2 ▶sub pending_jobs {
Subroutine pending_jobs: called CC=1 SCAR=0.0
Pod documented
69 2 return @{ $_[0]->{job_queue} };
70 }
71  
72 0 ▶sub current_job {
Subroutine current_job: not called CC=2 SCAR=17.9
Pod documented
73 0 my $self = shift;
74 0 ▶ return unless $self->{_current_job};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"_current_job"} 0 0 0
75 0 my $item = Storable::dclone( $self->{_current_job} );
76 0 return $item;
77 }
78  
79 0 ▶sub current_log {
Subroutine current_log: not called CC=2 SCAR=17.9
Pod documented
80 0 my $self = shift;
81 0 ▶ return unless $self->{_wheel_log};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"_wheel_log"} 0 0 0
82 0 my $item = Storable::dclone( $self->{_wheel_log} );
83 0 return $item;
84 }
85  
86 1 ▶sub pause_queue {
Subroutine pause_queue: called CC=1 SCAR=0.0
Pod documented
87 1 my $self = shift;
88 1 $self->{paused} = 1;
89 }
90  
91 1 ▶sub resume_queue {
Subroutine resume_queue: called CC=2 SCAR=7.1
Pod documented
92 1 my $self = shift;
93 1 my $pause = delete $self->{paused};
94 1 ▶ $poe_kernel->post( $self->{session_id}, '_spawn_wheel' ) if $pause;
Branch: 1 branch
BranchTrueFalseTotal
if $pause 1 0 1
95 }
96  
97 3 ▶sub paused {
Subroutine paused: called CC=1 SCAR=0.0
Pod documented
98 3 return $_[0]->{paused};
99 }
100  
101 1 ▶sub statistics {
Subroutine statistics: called CC=3 SCAR=11.7
Pod documented
102 1 my $self = shift;
103 1 my @stats;
104 1 push @stats, $self->{stats}->{$_} for qw(started totaljobs avg_run min_run max_run);
105 1 ▶ return @stats if wantarray;
Branch: 1 branch
BranchTrueFalseTotal
if wantarray 1 0 1
106 0 return \@stats;
107 }
108  
109 0 ▶sub shutdown {
Subroutine shutdown: not called CC=1 SCAR=6.9
Pod documented
110 0 my $self = shift;
111 0 $poe_kernel->post( $self->{session_id}, 'shutdown' );
112 }
113  
114 11 ▶sub _start {
Subroutine _start: called CC=5 SCAR=16.8
115 11 my ($kernel,$self) = @_[KERNEL,OBJECT];
116 11 $kernel->sig( 'HUP', '_sig_handle' );
117 11 $self->{session_id} = $_[SESSION]->ID();
118 11 ▶ if ( $self->{alias} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'alias'}) { } 11 0 11
119 11 $kernel->alias_set( $self->{alias} );
120 } else {
121 0 $kernel->refcount_increment( $self->{session_id} => __PACKAGE__ );
122 }
123 11 $self->{job_queue} = [ ];
124 11 ▶ $self->{idle} = 600 unless $self->{idle};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"idle"} 11 0 11
125 11 ▶ $self->{timeout} = 3600 unless $self->{timeout};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"timeout"} 11 0 11
126 $self->{stats} = {
127 11 started => time(),
128 totaljobs => 0,
129 avg_run => 0,
130 min_run => 0,
131 max_run => 0,
132 _sum => 0,
133 };
134 11 ▶ $ENV{APPDATA} = $self->{appdata} if $self->{appdata};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"appdata"} 0 11 11
135 11 undef;
136 }
137  
138 1 ▶sub _sig_handle {
Subroutine _sig_handle: called CC=1 SCAR=0.0
139 1 $poe_kernel->sig_handled();
140 }
141  
142 11 ▶sub _shutdown {
Subroutine _shutdown: called CC=4 SCAR=13.9
143 11 my ($kernel,$self) = @_[KERNEL,OBJECT];
144 11 $kernel->sig( 'HUP' );
145 11 $kernel->sig( 'KILL' );
146 11 $kernel->alias_remove( $_ ) for $kernel->alias_list();
147 11 ▶ $kernel->refcount_decrement( $self->{session_id} => __PACKAGE__ ) unless $self->{alias};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"alias"} 0 11 11
148 11 $kernel->refcount_decrement( $_->{session}, __PACKAGE__ ) for @{ $self->{job_queue} };
149 11 $self->{_shutdown} = 1;
150 11 undef;
151 }
152  
153 11 ▶sub _command {
Subroutine _command: called CC=65 SCAR=65.3
154 11 my ($kernel,$self,$state,$sender) = @_[KERNEL,OBJECT,STATE,SENDER];
155 11 ▶ return if $self->{_shutdown};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"_shutdown"} 0 11 11
156 11 my $args;
157 11 ▶ if ( ref( $_[ARG0] ) eq 'HASH' ) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $_[10] eq 'HASH') { } 11 0 11
158 11 $args = { %{ $_[ARG0] } };
159 } else {
160 0 $args = { @_[ARG0..$#_] };
161 }
162  
163 11 ▶ $state = 'push' if $state eq 'submit';
Branch: 1 branch
BranchTrueFalseTotal
if $state eq "submit" 5 6 11
164  
165 11 $args->{lc $_} = delete $args->{$_} for grep { $_ !~ /^_/ } keys %{ $args };
166  
167 11 ▶ my $ref = $args->{session} ? $kernel->alias_resolve( $args->{session} ) : $sender;
Branch: 1 branch
BranchTrueFalseTotal
$args->{'session'} ? : 0 11 11
168 11 $args->{session} = $ref->ID();
169  
170 11 ▶ if ( !$args->{module} and $state !~ /^(recent|check|indices|package|author|flush)$/i ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($args->{"module"} or $state =~ /^(recent|check|indices|package|author|flush)$/i) 0 11 11
Condition66%2/3
$args->{"module"} or $state =~ /^(recent|check|indices|package|author|flush)$/i
l!l&&r!l&&!r
560
MC/DC0%0/2
$args->{"module"} or $state =~ /^(recent|check|indices|package|author|flush)$/i
$args->{"module"} $state =~ /^(recent|check|indices|package|author|flush)$/i
Truth table66%2/3
A or B
A= $args->{"module"}B= $state =~ /^(recent|check|indices|package|author|flush)$/i
ABresult
1X1
011
000
171 0 warn "No 'module' specified for $state";
172 0 return;
173 }
174  
175 11 ▶ unless ( $args->{event} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($args->{"event"}) 0 11 11
176 0 warn "No 'event' specified for $state";
177 0 return;
178 }
179  
180 11 ▶ if ( $state =~ /^(package|author)$/ and !$args->{search} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($state =~ /^(package|author)$/ and not $args->{"search"}) 0 11 11
Condition66%2/3
$state =~ /^(package|author)$/ and not $args->{"search"}
!ll&&!rl&&r
920
MC/DC0%0/2
$state =~ /^(package|author)$/ and not $args->{"search"}
$state =~ /^(package|author)$/ not $args->{"search"}
Truth table66%2/3
A and not(B)
A= $state =~ /^(package|author)$/B= not $args->{"search"}
ABresult
0X0
100
111
181 0 warn "No 'search' criteria specified for $state";
182 0 return;
183 }
184  
185 11 $args->{submitted} = time();
186  
187 11 ▶ if ( $state eq 'recent' ) {
Branch: 6 branches
BranchTrueFalseTotal
if ($state eq 'recent') { } 1 10 11
elsif ($state eq 'check') { } 1 9 10
elsif ($state eq 'indices') { } 1 8 9
elsif ($state eq 'author') { } 1 7 8
elsif ($state eq 'package') { } 1 6 7
elsif ($state eq 'flush') { } 1 5 6
188 1 ▶ if ( $^O eq 'MSWin32' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($^O eq 'MSWin32') { } 0 1 1
189 0 $args->{program} = \&_recent_modules;
190 0 ▶ $args->{program_args} = [ $args->{perl} || $self->{perl} || $^X ];
Condition0%0/6
$args->{'perl'} || $self->{'perl'} || $^X
l!l&&r!l&&!r
000
$args->{"perl"} or $self->{"perl"}
l!l&&r!l&&!r
000
MC/DC0%0/3
$args->{'perl'} || $self->{'perl'} || $^X
$args->{"perl"} $self->{"perl"} $^X
Truth table0%0/4
A or B || C
A= $args->{"perl"}B= $self->{"perl"}C= $^X
ABCresult
1XX1
01X1
0011
0000
191 }
192 else {
193 1 ▶ my $perl = $args->{perl} || $self->{perl} || $^X;
Condition33%2/6
$args->{'perl'} || $self->{'perl'} || $^X
l!l&&r!l&&!r
100
$args->{"perl"} or $self->{"perl"}
l!l&&r!l&&!r
100
MC/DC0%0/3
$args->{'perl'} || $self->{'perl'} || $^X
$args->{"perl"} $self->{"perl"} $^X
Truth table25%1/4
A or B || C
A= $args->{"perl"}B= $self->{"perl"}C= $^X
ABCresult
1XX1
01X1
0011
0000
194 1 my $code = 'my $smoke = CPANPLUS::YACSmoke->new(); print "$_\n" for $smoke->_download_list();';
195 1 $args->{program} = [ $perl, '-MCPANPLUS::YACSmoke', '-e', $code ];
196 }
197 }
198 elsif ( $state eq 'check' ) {
199 1 ▶ if ( $^O eq 'MSWin32' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($^O eq 'MSWin32') { } 0 1 1
200 0 $args->{program} = \&_check_yacsmoke;
201 0 ▶ $args->{program_args} = [ $args->{perl} || $self->{perl} || $^X ];
Condition0%0/6
$args->{'perl'} || $self->{'perl'} || $^X
l!l&&r!l&&!r
000
$args->{"perl"} or $self->{"perl"}
l!l&&r!l&&!r
000
MC/DC0%0/3
$args->{'perl'} || $self->{'perl'} || $^X
$args->{"perl"} $self->{"perl"} $^X
Truth table0%0/4
A or B || C
A= $args->{"perl"}B= $self->{"perl"}C= $^X
ABCresult
1XX1
01X1
0011
0000
202 }
203 else {
204 1 ▶ my $perl = $args->{perl} || $self->{perl} || $^X;
Condition33%2/6
$args->{'perl'} || $self->{'perl'} || $^X
l!l&&r!l&&!r
010
$args->{"perl"} or $self->{"perl"}
l!l&&r!l&&!r
001
MC/DC0%0/3
$args->{'perl'} || $self->{'perl'} || $^X
$args->{"perl"} $self->{"perl"} $^X
Truth table25%1/4
A or B || C
A= $args->{"perl"}B= $self->{"perl"}C= $^X
ABCresult
1XX1
01X1
0011
0000
205 1 $args->{program} = [ $perl, '-MCPANPLUS::YACSmoke', '-e', 1 ];
206 }
207 1 $args->{debug} = 1;
208 }
209 elsif ( $state eq 'indices' ) {
210 1 ▶ $args->{prioritise} = 0 unless $args->{prioritise};
Branch: 1 branch
BranchTrueFalseTotal
unless $args->{"prioritise"} 1 0 1
211 1 ▶ if ( $^O eq 'MSWin32' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($^O eq 'MSWin32') { } 0 1 1
212 0 $args->{program} = \&_reload_indices;
213 0 ▶ $args->{program_args} = [ $args->{perl} || $self->{perl} || $^X ];
Condition0%0/6
$args->{'perl'} || $self->{'perl'} || $^X
l!l&&r!l&&!r
000
$args->{"perl"} or $self->{"perl"}
l!l&&r!l&&!r
000
MC/DC0%0/3
$args->{'perl'} || $self->{'perl'} || $^X
$args->{"perl"} $self->{"perl"} $^X
Truth table0%0/4
A or B || C
A= $args->{"perl"}B= $self->{"perl"}C= $^X
ABCresult
1XX1
01X1
0011
0000
214 }
215 else {
216 1 ▶ my $perl = $args->{perl} || $self->{perl} || $^X;
Condition33%2/6
$args->{'perl'} || $self->{'perl'} || $^X
l!l&&r!l&&!r
100
$args->{"perl"} or $self->{"perl"}
l!l&&r!l&&!r
100
MC/DC0%0/3
$args->{'perl'} || $self->{'perl'} || $^X
$args->{"perl"} $self->{"perl"} $^X
Truth table25%1/4
A or B || C
A= $args->{"perl"}B= $self->{"perl"}C= $^X
ABCresult
1XX1
01X1
0011
0000
217 1 my $code = 'CPANPLUS::Backend->new()->reload_indices( update_source => 1 );';
218 1 $args->{program} = [ $perl, '-MCPANPLUS::Backend', '-e', $code ];
219 }
220 }
221 elsif ( $state eq 'author' ) {
222 1 ▶ if ( $^O eq 'MSWin32' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($^O eq 'MSWin32') { } 0 1 1
223 0 $args->{program} = \&_author_search;
224 0 ▶ $args->{program_args} = [ $args->{perl} || $self->{perl} || $^X, $args->{type} || 'cpanid', $args->{search} ];
Condition0%0/8
$args->{'perl'} || $self->{'perl'} || $^X
l!l&&r!l&&!r
000
$args->{"perl"} or $self->{"perl"}
l!l&&r!l&&!r
000
$args->{'type'} || 'cpanid'
l!l
00
MC/DC0%0/3
$args->{'perl'} || $self->{'perl'} || $^X
$args->{"perl"} $self->{"perl"} $^X
MC/DC0%0/1
$args->{'type'} || 'cpanid'
$args->{'type'}
Truth table0%0/4
A or B || C
A= $args->{"perl"}B= $self->{"perl"}C= $^X
ABCresult
1XX1
01X1
0011
0000
Truth table0%0/2
A
A= $args->{'type'}
Aresult
11
00
225 }
226 else {
227 1 ▶ my $perl = $args->{perl} || $self->{perl} || $^X;
Condition33%2/6
$args->{'perl'} || $self->{'perl'} || $^X
l!l&&r!l&&!r
100
$args->{"perl"} or $self->{"perl"}
l!l&&r!l&&!r
100
MC/DC0%0/3
$args->{'perl'} || $self->{'perl'} || $^X
$args->{"perl"} $self->{"perl"} $^X
Truth table25%1/4
A or B || C
A= $args->{"perl"}B= $self->{"perl"}C= $^X
ABCresult
1XX1
01X1
0011
0000
228 1 my $code = 'my $type = shift; my $search = shift; my $cb = CPANPLUS::Backend->new(); my %mods = map { $_->package() => 1 } map { $_->modules() } $cb->search( type => $type, allow => [ qr/$search/ ], verbose => 0 ); print qq{$_\n} for sort keys %mods;';
229 1 ▶ $args->{program} = [ $perl, '-MCPANPLUS::Backend', '-e', $code, $args->{type} || 'cpanid', $args->{search} ];
Condition50%1/2
$args->{'type'} || 'cpanid'
l!l
01
MC/DC0%0/1
$args->{'type'} || 'cpanid'
$args->{'type'}
Truth table50%1/2
A
A= $args->{'type'}
Aresult
11
00
230 }
231 }
232 elsif ( $state eq 'package' ) {
233 1 ▶ if ( $^O eq 'MSWin32' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($^O eq 'MSWin32') { } 0 1 1
234 0 $args->{program} = \&_package_search;
235 0 ▶ $args->{program_args} = [ $args->{perl} || $self->{perl} || $^X, $args->{type} || 'package', $args->{search} ];
Condition0%0/8
$args->{'perl'} || $self->{'perl'} || $^X
l!l&&r!l&&!r
000
$args->{"perl"} or $self->{"perl"}
l!l&&r!l&&!r
000
$args->{'type'} || 'package'
l!l
00
MC/DC0%0/3
$args->{'perl'} || $self->{'perl'} || $^X
$args->{"perl"} $self->{"perl"} $^X
MC/DC0%0/1
$args->{'type'} || 'package'
$args->{'type'}
Truth table0%0/4
A or B || C
A= $args->{"perl"}B= $self->{"perl"}C= $^X
ABCresult
1XX1
01X1
0011
0000
Truth table0%0/2
A
A= $args->{'type'}
Aresult
11
00
236 }
237 else {
238 1 ▶ my $perl = $args->{perl} || $self->{perl} || $^X;
Condition33%2/6
$args->{'perl'} || $self->{'perl'} || $^X
l!l&&r!l&&!r
100
$args->{"perl"} or $self->{"perl"}
l!l&&r!l&&!r
100
MC/DC0%0/3
$args->{'perl'} || $self->{'perl'} || $^X
$args->{"perl"} $self->{"perl"} $^X
Truth table25%1/4
A or B || C
A= $args->{"perl"}B= $self->{"perl"}C= $^X
ABCresult
1XX1
01X1
0011
0000
239 1 my $code = 'my $type = shift; my $search = shift; my $cb = CPANPLUS::Backend->new(); my %mods = map { $_->package() => 1 } $cb->search( type => $type, allow => [ qr/$search/ ], verbose => 0 ); print qq{$_\n} for sort keys %mods;';
240 1 ▶ $args->{program} = [ $perl, '-MCPANPLUS::Backend', '-e', $code, $args->{type} || 'package', $args->{search} ];
Condition50%1/2
$args->{'type'} || 'package'
l!l
01
MC/DC0%0/1
$args->{'type'} || 'package'
$args->{'type'}
Truth table50%1/2
A
A= $args->{'type'}
Aresult
11
00
241 }
242 }
243 elsif ( $state eq 'flush' ) {
244 1 ▶ $args->{prioritise} = 0 unless $args->{prioritise};
Branch: 1 branch
BranchTrueFalseTotal
unless $args->{"prioritise"} 1 0 1
245 1 ▶ if ( $^O eq 'MSWin32' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($^O eq 'MSWin32') { } 0 1 1
246 0 $args->{program} = \&_flush;
247 0 ▶ $args->{program_args} = [ $args->{perl} || $self->{perl} || $^X, ( $args->{type} and $args->{type} eq 'all' ? 'all' : 'old' ) ];
Branch: 1 branch
BranchTrueFalseTotal
$args->{'type'} eq 'all' ? : 0 0 0
Condition0%0/9
$args->{'perl'} || $self->{'perl'} || $^X
l!l&&r!l&&!r
000
$args->{"perl"} or $self->{"perl"}
l!l&&r!l&&!r
000
$args->{'type'} && ($args->{'type'} eq 'all' ? 'all' : 'old')
!ll&&!rl&&r
000
MC/DC0%0/3
$args->{'perl'} || $self->{'perl'} || $^X
$args->{"perl"} $self->{"perl"} $^X
MC/DC0%0/2
$args->{'type'} && ($args->{'type'} eq 'all' ? 'all' : 'old')
$args->{'type'} ($args->{'type'} eq 'all' ? 'all' : 'old')
Truth table0%0/4
A or B || C
A= $args->{"perl"}B= $self->{"perl"}C= $^X
ABCresult
1XX1
01X1
0011
0000
Truth table0%0/3
A && B
A= $args->{'type'}B= ($args->{'type'} eq 'all' ? 'all' : 'old')
ABresult
0X0
100
111
248 }
249 else {
250 1 ▶ my $perl = $args->{perl} || $self->{perl} || $^X;
Condition33%2/6
$args->{'perl'} || $self->{'perl'} || $^X
l!l&&r!l&&!r
100
$args->{"perl"} or $self->{"perl"}
l!l&&r!l&&!r
100
MC/DC0%0/3
$args->{'perl'} || $self->{'perl'} || $^X
$args->{"perl"} $self->{"perl"} $^X
Truth table25%1/4
A or B || C
A= $args->{"perl"}B= $self->{"perl"}C= $^X
ABCresult
1XX1
01X1
0011
0000
251 1 my $code = 'my $type = shift; my $smoke = CPANPLUS::YACSmoke->new(); $smoke->flush($type) if $smoke->can("flush");';
252 1 ▶ $args->{program} = [ $perl, '-MCPANPLUS::YACSmoke', '-e', $code, ( $args->{type} and $args->{type} eq 'all' ? 'all' : 'old' ) ];
Branch: 1 branch
BranchTrueFalseTotal
$args->{'type'} eq 'all' ? : 0 0 0
Condition33%1/3
$args->{'type'} && ($args->{'type'} eq 'all' ? 'all' : 'old')
!ll&&!rl&&r
100
MC/DC0%0/2
$args->{'type'} && ($args->{'type'} eq 'all' ? 'all' : 'old')
$args->{'type'} ($args->{'type'} eq 'all' ? 'all' : 'old')
Truth table33%1/3
A && B
A= $args->{'type'}B= ($args->{'type'} eq 'all' ? 'all' : 'old')
ABresult
0X0
100
111
253 }
254 }
255 else {
256 5 ▶ if ( $^O eq 'MSWin32' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($^O eq 'MSWin32') { } 0 5 5
257 0 $args->{program} = \&_test_module;
258 0 ▶ $args->{program_args} = [ $args->{perl} || $self->{perl} || $^X, $args->{module} ];
Condition0%0/6
$args->{'perl'} || $self->{'perl'} || $^X
l!l&&r!l&&!r
000
$args->{"perl"} or $self->{"perl"}
l!l&&r!l&&!r
000
MC/DC0%0/3
$args->{'perl'} || $self->{'perl'} || $^X
$args->{"perl"} $self->{"perl"} $^X
Truth table0%0/4
A or B || C
A= $args->{"perl"}B= $self->{"perl"}C= $^X
ABCresult
1XX1
01X1
0011
0000
259 }
260 else {
261 5 ▶ my $perl = $args->{perl} || $self->{perl} || $^X;
Condition33%2/6
$args->{'perl'} || $self->{'perl'} || $^X
l!l&&r!l&&!r
500
$args->{"perl"} or $self->{"perl"}
l!l&&r!l&&!r
500
MC/DC0%0/3
$args->{'perl'} || $self->{'perl'} || $^X
$args->{"perl"} $self->{"perl"} $^X
Truth table25%1/4
A or B || C
A= $args->{"perl"}B= $self->{"perl"}C= $^X
ABCresult
1XX1
01X1
0011
0000
262 5 my $code = 'my $module = shift; my $smoke = CPANPLUS::YACSmoke->new(); $smoke->test($module);';
263 5 $args->{program} = [ $perl, '-MCPANPLUS::YACSmoke', '-e', $code, $args->{module} ];
264 }
265 }
266  
267 11 $kernel->refcount_increment( $args->{session}, __PACKAGE__ );
268  
269 11 $args->{cmd} = $state;
270  
271 11 ▶ if ( $state eq 'unshift' or $state eq 'recent' or $args->{prioritise} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($state eq 'unshift' or $state eq 'recent' or $args->{'prioritise'}) { } 1 10 11
Condition66%4/6
$state eq "unshift" or $state eq "recent" or $args->{"prioritise"}
l!l&&r!l&&!r
1010
$state eq "unshift" or $state eq "recent"
l!l&&r!l&&!r
0110
MC/DC33%1/3
$state eq "unshift" or $state eq "recent" or $args->{"prioritise"}
$state eq "unshift" $state eq "recent" $args->{"prioritise"}
Truth table50%2/4
A or B or C
A= $state eq "unshift"B= $state eq "recent"C= $args->{"prioritise"}
ABCresult
1XX1
01X1
0011
0000
272 1 unshift @{ $self->{job_queue} }, $args;
273 }
274 else {
275 10 push @{ $self->{job_queue} }, $args;
276 }
277  
278 11 $kernel->yield( '_spawn_wheel' );
279  
280 11 undef;
281 }
282  
283 11 ▶sub _sig_child {
Subroutine _sig_child: called CC=10 SCAR=23.0
284 11 my ($kernel,$self,$thing,$pid,$status) = @_[KERNEL,OBJECT,ARG0..ARG2];
285 11 push @{ $self->{_wheel_log} }, "$thing $pid $status";
286 11 ▶ warn "$thing $pid $status\n" if $self->{debug};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"debug"} 5 6 11
287 11 $kernel->delay( '_wheel_idle' );
288 11 delete $self->{_digests};
289 11 delete $self->{_loop_detect};
290 11 my $job = delete $self->{_current_job};
291 11 $job->{status} = $status;
292 11 my $log = delete $self->{_wheel_log};
293 11 ▶ if ( $job->{cmd} eq 'recent' ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($job->{'cmd'} eq 'recent') { } 1 10 11
elsif ($job->{'cmd'} =~ /^(package|author)$/) { } 2 8 10
294 1 pop @{ $log };
295 1 s/\x0D$// for @{ $log };
296 1 $job->{recent} = $log;
297 }
298 elsif ( $job->{cmd} =~ /^(package|author)$/ ) {
299 2 pop @{ $log };
300 2 s/\x0D$// for @{ $log };
301 2 @{ $job->{results} } = grep { $_ !~ /^\[/ } @{ $log };
302 }
303 else {
304 8 $job->{log} = $log;
305 }
306 11 $job->{end_time} = time();
307 11 ▶ unless ( $self->{debug} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->{"debug"}) 6 5 11
308 6 delete $job->{program};
309 6 delete $job->{program_args};
310 }
311 # Stats
312 11 my $run_time = $job->{end_time} - $job->{start_time};
313 11 ▶ $self->{stats}->{max_run} = $run_time if $run_time > $self->{stats}->{max_run};
Branch: 1 branch
BranchTrueFalseTotal
if $run_time > $self->{"stats"}{"max_run"} 0 11 11
314 11 ▶ $self->{stats}->{min_run} = $run_time if $self->{stats}->{min_run} == 0;
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"stats"}{"min_run"} == 0 11 0 11
315 11 ▶ $self->{stats}->{min_run} = $run_time if $run_time < $self->{stats}->{min_run};
Branch: 1 branch
BranchTrueFalseTotal
if $run_time < $self->{"stats"}{"min_run"} 0 11 11
316 11 $self->{stats}->{_sum} += $run_time;
317 11 $self->{stats}->{totaljobs}++;
318 11 $self->{stats}->{avg_run} = $self->{stats}->{_sum} / $self->{stats}->{totaljobs};
319 11 $self->{debug} = delete $job->{global_debug};
320 #$ENV{APPDATA} = delete $job->{backup_env} if $job->{appdata};
321 11 $kernel->post( $job->{session}, $job->{event}, $job );
322 11 $kernel->refcount_decrement( $job->{session}, __PACKAGE__ );
323 11 $kernel->yield( '_spawn_wheel' );
324 11 $kernel->sig_handled();
325 }
326  
327 23 ▶sub _spawn_wheel {
Subroutine _spawn_wheel: called CC=13 SCAR=28.8
328 23 my ($kernel,$self) = @_[KERNEL,OBJECT];
329 23 ▶ return if $self->{wheel};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"wheel"} 0 23 23
330 23 ▶ return if $self->{_shutdown};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"_shutdown"} 0 23 23
331 23 ▶ return if $self->{paused};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"paused"} 1 22 23
332 22 my $job = shift @{ $self->{job_queue} };
333 22 ▶ return unless $job;
Branch: 1 branch
BranchTrueFalseTotal
unless $job 11 11 22
334 11 my $backup_env;
335 11 ▶ if ( $job->{appdata} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($job->{"appdata"}) 0 11 11
336 0 $backup_env = $ENV{APPDATA};
337 0 $ENV{APPDATA} = $job->{appdata};
338 }
339 $self->{wheel} = POE::Wheel::Run->new(
340 Program => $job->{program},
341 ProgramArgs => $job->{program_args},
342 StdoutEvent => '_wheel_stdout',
343 StderrEvent => '_wheel_stderr',
344 ErrorEvent => '_wheel_error',
345 CloseEvent => '_wheel_close',
346 11 ▶ ( $GOT_PTY and !$self->{no_pty} ? ( Conduit => 'pty-pipe' ) : () ),
Branch: 1 branch
BranchTrueFalseTotal
!$self->{'no_pty'} ? : 11 0 11
Condition33%1/3
$GOT_PTY && (!$self->{'no_pty'} ? ('Conduit', 'pty-pipe') : ())
!ll&&!rl&&r
0011
MC/DC0%0/2
$GOT_PTY && (!$self->{'no_pty'} ? ('Conduit', 'pty-pipe') : ())
$GOT_PTY (!$self->{'no_pty'} ? ('Conduit', 'pty-pipe') : ())
Truth table33%1/3
A && not(B)
A= $GOT_PTYB= (!$self->{'no_pty'} ? ('Conduit', 'pty-pipe') : ())
ABresult
0X0
100
111
347 );
348 11 ▶ if ( $job->{appdata} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($job->{"appdata"}) 0 11 11
349 0 delete $ENV{APPDATA};
350 0 ▶ $ENV{APPDATA} = $backup_env if $backup_env;
Branch: 1 branch
BranchTrueFalseTotal
if $backup_env 0 0 0
351 }
352 11 ▶ unless ( $self->{wheel} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->{"wheel"}) 0 11 11
353 0 warn "Couldn\'t spawn a wheel for $job->{module}\n";
354 0 $kernel->refcount_decrement( $job->{session}, __PACKAGE__ );
355 0 return;
356 }
357 11 ▶ if ( defined $job->{debug} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $job->{"debug"}) 5 6 11
358 5 $job->{global_debug} = delete $self->{debug};
359 5 $self->{debug} = $job->{debug};
360 }
361 11 $self->{_wheel_log} = [ ];
362 11 $self->{_digests} = { };
363 11 $self->{_loop_detect} = 0;
364 11 $self->{_current_job} = $job;
365 11 $job->{PID} = $self->{wheel}->PID();
366 11 $job->{start_time} = time();
367 11 $kernel->sig_child( $job->{PID}, '_sig_child' );
368 11 ▶ $kernel->delay( '_wheel_idle', 60 ) unless $job->{cmd} eq 'indices';
Branch: 1 branch
BranchTrueFalseTotal
unless $job->{"cmd"} eq "indices" 10 1 11
369 11 undef;
370 }
371  
372 11 ▶sub _wheel_error {
Subroutine _wheel_error: called CC=1 SCAR=0.0
373 11 $poe_kernel->delay( '_wheel_idle' );
374 11 delete $_[OBJECT]->{wheel};
375 11 undef;
376 }
377  
378 0 ▶sub _wheel_closed {
Subroutine _wheel_closed: not called CC=1 SCAR=6.9
379 0 $poe_kernel->delay( '_wheel_idle' );
380 0 delete $_[OBJECT]->{wheel};
381 0 undef;
382 }
383  
384 0 ▶sub _wheel_stdout {
Subroutine _wheel_stdout: not called CC=3 SCAR=24.8
385 0 my ($self, $input, $wheel_id) = @_[OBJECT, ARG0, ARG1];
386 0 $self->{_wheel_time} = time();
387 0 push @{ $self->{_wheel_log} }, $input;
388 0 ▶ warn $input, "\n" if $self->{debug};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"debug"} 0 0 0
389 0 ▶ if ( $self->_detect_loop( $input ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->_detect_loop($input)) 0 0 0
390 0 $self->{_current_job}->{excess_kill} = 1;
391 0 $poe_kernel->yield( '_wheel_kill', 'Killing current run CPAN::Shell loop detected' );
392 0 return;
393 }
394 0 undef;
395 }
396  
397 10 ▶sub _wheel_stderr {
Subroutine _wheel_stderr: called CC=8 SCAR=26.7
398 10 my ($self, $input, $wheel_id) = @_[OBJECT, ARG0, ARG1];
399 10 $self->{_wheel_time} = time();
400 10 ▶ if ( $^O eq 'MSWin32' and !$self->{_current_job}->{GRP_PID} and my ($pid) = $input =~ /(\d+)/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($^O eq "MSWin32" and not $self->{"_current_job"}{"GRP_PID"} and my($pid) = $input =~ /(\d+)/) 0 10 10
Condition33%2/6
$^O eq "MSWin32" and not $self->{"_current_job"}{"GRP_PID"} and my($pid) = $input =~ /(\d+)/
!ll&&!rl&&r
1000
$^O eq "MSWin32" and not $self->{"_current_job"}{"GRP_PID"}
!ll&&!rl&&r
1000
MC/DC0%0/3
$^O eq "MSWin32" and not $self->{"_current_job"}{"GRP_PID"} and my($pid) = $input =~ /(\d+)/
$^O eq "MSWin32" not $self->{"_current_job"}{"GRP_PID"} my($pid) = $input =~ /(\d+)/
Truth table25%1/4
A and not(B) and C
A= $^O eq "MSWin32"B= not $self->{"_current_job"}{"GRP_PID"}C= my($pid) = $input =~ /(\d+)/
ABCresult
0XX0
10X0
1100
1111
401 0 $self->{_current_job}->{GRP_PID} = $pid;
402 0 ▶ warn "Grp PID: $pid\n" if $self->{debug};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"debug"} 0 0 0
403 0 return;
404 }
405 10 ▶ push @{ $self->{_wheel_log} }, $input unless $self->{_current_job}->{cmd} eq 'recent';
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"_current_job"}{"cmd"} eq "recent" 9 1 10
406 10 ▶ warn $input, "\n" if $self->{debug};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"debug"} 6 4 10
407 10 ▶ if ( $self->_detect_loop( $input ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->_detect_loop($input)) 0 10 10
408 0 $self->{_current_job}->{excess_kill} = 1;
409 0 $poe_kernel->yield( '_wheel_kill', 'Killing current run CPAN::Shell loop detected' );
410 0 return;
411 }
412 10 undef;
413 }
414  
415 10 ▶sub _detect_loop {
Subroutine _detect_loop: called CC=4 SCAR=15.0
416 10 my $self = shift;
417 10 ▶ my $input = shift || return;
Condition50%1/2
shift() || (return)
l!l
100
MC/DC0%0/1
shift() || (return)
shift()
Truth table50%1/2
A
A= shift()
Aresult
11
00
418 10 ▶ return if $self->{_loop_detect};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"_loop_detect"} 0 10 10
419 10 my $digest = md5_hex( $input );
420 10 $self->{_digests}->{ $digest }++;
421 10 ▶ return unless ++$self->{_digests}->{ $digest } > 300;
Branch: 1 branch
BranchTrueFalseTotal
unless ++$self->{"_digests"}{$digest} > 300 10 0 10
422 0 return $self->{_loop_detect} = 1;
423 }
424  
425 0 ▶sub _wheel_idle {
Subroutine _wheel_idle: not called CC=3 SCAR=24.8
426 0 my ($kernel,$self) = @_[KERNEL,OBJECT];
427 0 my $now = time();
428 0 ▶ if ( $now - $self->{_wheel_time} >= $self->{idle} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($now - $self->{"_wheel_time"} >= $self->{"idle"}) 0 0 0
429 0 $self->{_current_job}->{idle_kill} = 1;
430 0 $kernel->yield( '_wheel_kill', 'Killing current run due to excessive idle' );
431 0 return;
432 }
433 0 ▶ if ( $now - $self->{_current_job}->{start_time} >= $self->{timeout} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($now - $self->{"_current_job"}{"start_time"} >= $self->{"timeout"}) 0 0 0
434 0 $self->{_current_job}->{excess_kill} = 1;
435 0 $kernel->yield( '_wheel_kill', 'Killing current run due to excessive run-time' );
436 0 return;
437 }
438 0 $kernel->delay( '_wheel_idle', 60 );
439 0 return;
440 }
441  
442 0 ▶sub _wheel_kill {
Subroutine _wheel_kill: not called CC=13 SCAR=52.0
443 0 my ($kernel,$self,$reason) = @_[KERNEL,OBJECT,ARG0];
444 0 push @{ $self->{_wheel_log} }, $reason;
445 0 ▶ warn $reason, "\n" if $self->{debug};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"debug"} 0 0 0
446 0 ▶ if ( $^O eq 'MSWin32' and $self->{wheel} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($^O eq 'MSWin32' and $self->{'wheel'}) { } 0 0 0
Condition0%0/3
$^O eq "MSWin32" and $self->{"wheel"}
!ll&&!rl&&r
000
MC/DC0%0/2
$^O eq "MSWin32" and $self->{"wheel"}
$^O eq "MSWin32" $self->{"wheel"}
Truth table0%0/3
A and B
A= $^O eq "MSWin32"B= $self->{"wheel"}
ABresult
0X0
100
111
447 0 my $grp_pid = $self->{_current_job}->{GRP_PID};
448 0 ▶ return unless $grp_pid;
Branch: 1 branch
BranchTrueFalseTotal
unless $grp_pid 0 0 0
449 0 ▶ warn Win32::FormatMessage( Win32::GetLastError() )
Branch: 1 branch
BranchTrueFalseTotal
unless Win32::Process::KillProcess($grp_pid, 0) 0 0 0
450 unless Win32::Process::KillProcess( $grp_pid, 0 );
451 }
452 else {
453 0 ▶ if ( !$self->{no_grp_kill} ) {
Branch: 2 branches
BranchTrueFalseTotal
if (not $self->{'no_grp_kill'}) { } 0 0 0
elsif ($GOT_KILLFAM) { } 0 0 0
454 0 ▶ if ( $^O eq 'solaris' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($^O eq 'solaris') { } 0 0 0
455 0 ▶ kill( 9, '-' . $self->{wheel}->PID() ) if $self->{wheel};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"wheel"} 0 0 0
456 }
457 else {
458 0 ▶ $self->{wheel}->kill(-9) if $self->{wheel};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"wheel"} 0 0 0
459 }
460 }
461 elsif ( $GOT_KILLFAM ) {
462 0 ▶ _kill_family( 9, $self->{wheel}->PID() ) if $self->{wheel};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"wheel"} 0 0 0
463 }
464 else {
465 0 ▶ $self->{wheel}->kill(9) if $self->{wheel};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"wheel"} 0 0 0
466 }
467 }
468 0 return;
469 }
470  
471 0 ▶sub _check_yacsmoke {
Subroutine _check_yacsmoke: not called CC=3 SCAR=24.8
472 0 my $perl = shift;
473 0 my $cmdline = $perl . q{ -MCPANPLUS::YACSmoke -e 1};
474 0 ▶ my $job = Win32::Job->new()
Branch: 1 branch
BranchTrueFalseTotal
my $job = "Win32::Job"->new or die Win32::FormatMessage(Win32::GetLastError()) 0 0 0
475 or die Win32::FormatMessage( Win32::GetLastError() );
476 0 ▶ my $pid = $job->spawn( $perl, $cmdline )
Branch: 1 branch
BranchTrueFalseTotal
my $pid = $job->spawn($perl, $cmdline) or die Win32::FormatMessage(Win32::GetLastError()) 0 0 0
477 or die Win32::FormatMessage( Win32::GetLastError() );
478 0 warn $pid, "\n";
479 0 ▶ my $ok = $job->watch( sub { 0 }, 60 );
Subroutine __ANON__: not called CC=1 SCAR=6.9
480 0 my $hashref = $job->status();
481 0 return $hashref->{$pid}->{exitcode};
482 }
483  
484 0 ▶sub _test_module {
Subroutine _test_module: not called CC=3 SCAR=24.8
485 0 my $perl = shift;
486 0 my $module = shift;
487 0 my $cmdline = $perl . ' -MCPANPLUS::YACSmoke -e "my $module = shift; my $smoke = CPANPLUS::YACSmoke->new(); $smoke->test($module);" ' . $module;
488 0 ▶ my $job = Win32::Job->new()
Branch: 1 branch
BranchTrueFalseTotal
my $job = "Win32::Job"->new or die Win32::FormatMessage(Win32::GetLastError()) 0 0 0
489 or die Win32::FormatMessage( Win32::GetLastError() );
490 0 ▶ my $pid = $job->spawn( $perl, $cmdline )
Branch: 1 branch
BranchTrueFalseTotal
my $pid = $job->spawn($perl, $cmdline) or die Win32::FormatMessage(Win32::GetLastError()) 0 0 0
491 or die Win32::FormatMessage( Win32::GetLastError() );
492 0 warn $pid, "\n";
493 0 ▶ my $ok = $job->watch( sub { 0 }, 60 );
Subroutine __ANON__: not called CC=1 SCAR=6.9
494 0 my $hashref = $job->status();
495 0 return $hashref->{$pid}->{exitcode};
496 }
497  
498 0 ▶sub _flush {
Subroutine _flush: not called CC=3 SCAR=24.8
499 0 my $perl = shift;
500 0 my $type = shift;
501 0 my $cmdline = $perl . ' -MCPANPLUS::YACSmoke -e "my $type = shift; my $smoke = CPANPLUS::YACSmoke->new(); $smoke->flush($type) if $smoke->can(q{flush});" ' . $type;
502 0 ▶ my $job = Win32::Job->new()
Branch: 1 branch
BranchTrueFalseTotal
my $job = "Win32::Job"->new or die Win32::FormatMessage(Win32::GetLastError()) 0 0 0
503 or die Win32::FormatMessage( Win32::GetLastError() );
504 0 ▶ my $pid = $job->spawn( $perl, $cmdline )
Branch: 1 branch
BranchTrueFalseTotal
my $pid = $job->spawn($perl, $cmdline) or die Win32::FormatMessage(Win32::GetLastError()) 0 0 0
505 or die Win32::FormatMessage( Win32::GetLastError() );
506 0 warn $pid, "\n";
507 0 ▶ my $ok = $job->watch( sub { 0 }, 60 );
Subroutine __ANON__: not called CC=1 SCAR=6.9
508 0 my $hashref = $job->status();
509 0 return $hashref->{$pid}->{exitcode};
510 }
511 0 ▶sub _recent_modules {
Subroutine _recent_modules: not called CC=3 SCAR=24.8
512 0 my $perl = shift;
513 0 my $cmdline = $perl . ' -MCPANPLUS::YACSmoke -e "my $smoke = CPANPLUS::YACSmoke->new();print qq{$_\n} for $smoke->{plugin}->download_list();"';
514 0 ▶ my $job = Win32::Job->new()
Branch: 1 branch
BranchTrueFalseTotal
my $job = "Win32::Job"->new or die Win32::FormatMessage(Win32::GetLastError()) 0 0 0
515 or die Win32::FormatMessage( Win32::GetLastError() );
516 0 ▶ my $pid = $job->spawn( $perl, $cmdline )
Branch: 1 branch
BranchTrueFalseTotal
my $pid = $job->spawn($perl, $cmdline) or die Win32::FormatMessage(Win32::GetLastError()) 0 0 0
517 or die Win32::FormatMessage( Win32::GetLastError() );
518 0 warn $pid, "\n";
519 0 ▶ my $ok = $job->watch( sub { 0 }, 60 );
Subroutine __ANON__: not called CC=1 SCAR=6.9
520 0 my $hashref = $job->status();
521 0 return $hashref->{$pid}->{exitcode};
522 }
523  
524 0 ▶sub _reload_indices {
Subroutine _reload_indices: not called CC=3 SCAR=24.8
525 0 my $perl = shift;
526 0 my $cmdline = $perl . ' -MCPANPLUS::Backend -e "CPANPLUS::Backend->new()->reload_indices( update_source => 1 );"';
527 0 ▶ my $job = Win32::Job->new()
Branch: 1 branch
BranchTrueFalseTotal
my $job = "Win32::Job"->new or die Win32::FormatMessage(Win32::GetLastError()) 0 0 0
528 or die Win32::FormatMessage( Win32::GetLastError() );
529 0 ▶ my $pid = $job->spawn( $perl, $cmdline )
Branch: 1 branch
BranchTrueFalseTotal
my $pid = $job->spawn($perl, $cmdline) or die Win32::FormatMessage(Win32::GetLastError()) 0 0 0
530 or die Win32::FormatMessage( Win32::GetLastError() );
531 0 warn $pid, "\n";
532 0 ▶ my $ok = $job->watch( sub { 0 }, 60 );
Subroutine __ANON__: not called CC=1 SCAR=6.9
533 0 my $hashref = $job->status();
534 0 return $hashref->{$pid}->{exitcode};
535 }
536  
537 0 ▶sub _author_search {
Subroutine _author_search: not called CC=3 SCAR=24.8
538 0 my $perl = shift;
539 0 my $type = shift;
540 0 my $search = shift;
541 0 my $cmdline = $perl . ' -MCPANPLUS::YACSmoke -e "my $type = shift; my $search = shift; my $cb = CPANPLUS::Backend->new(); my %mods = map { $_->package() => 1 } map { $_->modules() } $cb->search( type => $type, allow => [ qr/$search/ ], [ verbose => 0 ] ); print qq{$_\n} for sort keys %mods;" ' . $type . " " . $search;
542 0 ▶ my $job = Win32::Job->new()
Branch: 1 branch
BranchTrueFalseTotal
my $job = "Win32::Job"->new or die Win32::FormatMessage(Win32::GetLastError()) 0 0 0
543 or die Win32::FormatMessage( Win32::GetLastError() );
544 0 ▶ my $pid = $job->spawn( $perl, $cmdline )
Branch: 1 branch
BranchTrueFalseTotal
my $pid = $job->spawn($perl, $cmdline) or die Win32::FormatMessage(Win32::GetLastError()) 0 0 0
545 or die Win32::FormatMessage( Win32::GetLastError() );
546 0 warn $pid, "\n";
547 0 ▶ my $ok = $job->watch( sub { 0 }, 60 );
Subroutine __ANON__: not called CC=1 SCAR=6.9
548 0 my $hashref = $job->status();
549 0 return $hashref->{$pid}->{exitcode};
550 }
551  
552 0 ▶sub _package_search {
Subroutine _package_search: not called CC=3 SCAR=24.8
553 0 my $perl = shift;
554 0 my $type = shift;
555 0 my $search = shift;
556 0 my $cmdline = $perl . ' -MCPANPLUS::YACSmoke -e "my $type = shift; my $search = shift; my $cb = CPANPLUS::Backend->new(); my %mods = map { $_->package() => 1 } $cb->search( type => $type, allow => [ qr/$search/ ], [ verbose => 0 ] ); print qq{$_\n} for sort keys %mods;" ' . $type . " " . $search;
557 0 ▶ my $job = Win32::Job->new()
Branch: 1 branch
BranchTrueFalseTotal
my $job = "Win32::Job"->new or die Win32::FormatMessage(Win32::GetLastError()) 0 0 0
558 or die Win32::FormatMessage( Win32::GetLastError() );
559 0 ▶ my $pid = $job->spawn( $perl, $cmdline )
Branch: 1 branch
BranchTrueFalseTotal
my $pid = $job->spawn($perl, $cmdline) or die Win32::FormatMessage(Win32::GetLastError()) 0 0 0
560 or die Win32::FormatMessage( Win32::GetLastError() );
561 0 warn $pid, "\n";
562 0 ▶ my $ok = $job->watch( sub { 0 }, 60 );
Subroutine __ANON__: not called CC=1 SCAR=6.9
563 0 my $hashref = $job->status();
564 0 return $hashref->{$pid}->{exitcode};
565 }
566  
567 0 ▶sub _kill_family {
Subroutine _kill_family: not called CC=1 SCAR=6.9
568 0 my ($signal, @pids) = @_;
569 0 my $pt = Proc::ProcessTable->new;
570 0 my (@procs) = @{$pt->table};
571 0 my (@kids) = _get_pids( \@procs, @pids );
572 0 @pids = (@pids, @kids);
573 0 kill $signal, reverse @pids;
574 }
575  
576 0 ▶sub _get_pids {
Subroutine _get_pids: not called CC=4 SCAR=30.0
577 0 my($procs, @kids) = @_;
578 0 my @pids;
579 0 foreach my $kid (@kids) {
580 0 foreach my $proc (@$procs) {
581 0 ▶ if ($proc->ppid == $kid) {
Branch: 1 branch
BranchTrueFalseTotal
if ($proc->ppid == $kid) 0 0 0
582 0 my $pid = $proc->pid;
583 0 push @pids, $pid, _get_pids( $procs, $pid );
584 }
585 }
586 }
587 0 @pids;
588 }
589  
590 12 1;
591  
592 __END__
↑ Summary