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

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