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

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