Usul/IPC.pm

filter: Statementstmt 30.3% 58 / 191 Branchbran 2.6% 2 / 76 Conditioncond 0.0% 0 / 76 MC/DCmcdc 0.0% 0 / 44 Subroutinesub 51.8% 14 / 27 Podpod 100% 8 / 8 totaltotal 19.4% 82 / 422 CC 72 SCAR 53.1
CC
72
Cov
17%
__ANON__
552.0
signal_process
306.0
process_table
110.0
CRAP 202.0
« Usul/Time.pm ↑ Summary Usul/TraitFor/Prompting.pm »
1 package Class::Usul::IPC;
2  
3 17 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 17 ▶use Class::Null;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 17 ▶use Class::Usul::Constants qw( EXCEPTION_CLASS FALSE NUL OK SPC TRUE );
Subroutine BEGIN: called CC=1 SCAR=0.0
7 17 ▶use Class::Usul::Functions qw( arg_list get_user io loginid
Subroutine BEGIN: called CC=1 SCAR=0.0
8 17 merge_attributes throw );
9 17 ▶use Class::Usul::IPC::Cmd;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 17 ▶use Class::Usul::Time qw( time2str );
Subroutine BEGIN: called CC=1 SCAR=0.0
11 17 ▶use Class::Usul::Types qw( Bool ConfigProvider Logger );
Subroutine BEGIN: called CC=1 SCAR=0.0
12 17 ▶use English qw( -no_match_vars );
Subroutine BEGIN: called CC=1 SCAR=0.0
13 17 ▶use Module::Load::Conditional qw( can_load );
Subroutine BEGIN: called CC=1 SCAR=0.0
14 17 ▶use Unexpected::Functions qw( Unspecified );
Subroutine BEGIN: called CC=1 SCAR=0.0
15 17 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17 # Public attributes
18 17 has 'cache_ttys' => is => 'ro', isa => Bool, default => TRUE;
19  
20 17 has 'config' => is => 'ro', isa => ConfigProvider, required => TRUE;
21  
22 17 has 'log' => is => 'ro', isa => Logger, required => TRUE;
23  
24 # Private functions
25 0 ▶my $_cmd_matches = sub {
Subroutine __ANON__: not called CC=3 SCAR=24.8
26 0 my ($cmd, $pattern) = @_;
27  
28 0 ▶ return !$pattern || $cmd =~ m{ $pattern }msx ? TRUE : FALSE;
Branch: 1 branch
BranchTrueFalseTotal
!$pattern || $cmd =~ / $pattern /msx ? : 0 0 0
Condition0%0/3
not $pattern or $cmd =~ / $pattern /msx
l!l&&r!l&&!r
000
MC/DC0%0/2
not $pattern or $cmd =~ / $pattern /msx
not $pattern $cmd =~ / $pattern /msx
Truth table0%0/3
not(A) or B
A= not $patternB= $cmd =~ / $pattern /msx
ABresult
1X1
011
000
29 17 };
30  
31 0 ▶my $_new_proc_process_table = sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
32 0 my $cache_ttys = shift;
33  
34 0 ▶ can_load( modules => { 'Proc::ProcessTable' => '0' } )
Branch: 1 branch
BranchTrueFalseTotal
can_load("modules", {"Proc::ProcessTable", 0}) and return "Proc::ProcessTable"->new("cache_ttys", $cache_ttys) 0 0 0
35 and return Proc::ProcessTable->new( cache_ttys => $cache_ttys );
36  
37 0 return Class::Null->new;
38 17 };
39  
40 0 ▶my $_proc_belongs_to_user = sub {
Subroutine __ANON__: not called CC=4 SCAR=30.0
41 0 my ($puid, $user) = @_;
42  
43 0 ▶ return (!$user || $user eq 'All' || $user eq loginid $puid) ? TRUE : FALSE;
Branch: 1 branch
BranchTrueFalseTotal
!$user || $user eq 'All' || $user eq &loginid($puid) ? : 0 0 0
Condition0%0/6
not $user or $user eq "All" or $user eq &loginid($puid)
l!l&&r!l&&!r
000
not $user or $user eq "All"
l!l&&r!l&&!r
000
MC/DC0%0/3
not $user or $user eq "All" or $user eq &loginid($puid)
not $user $user eq "All" $user eq &loginid($puid)
Truth table0%0/4
not(A) or B or C
A= not $userB= $user eq "All"C= $user eq &loginid($puid)
ABCresult
1XX1
01X1
0011
0000
44 17 };
45  
46 0 ▶my $_pscomp = sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
47 0 my ($arg1, $arg2) = @_; my $result;
48  
49 0 $result = $arg1->{uid} cmp $arg2->{uid};
50 0 ▶ $result = $arg1->{pid} <=> $arg2->{pid} if ($result == 0);
Branch: 1 branch
BranchTrueFalseTotal
if $result == 0 0 0 0
51  
52 0 return $result;
53 17 };
54  
55 0 ▶my $_set_fields = sub {
Subroutine __ANON__: not called CC=23 SCAR=63.1
56 0 my ($has, $p) = @_; my $flds = {};
57  
58 0 ▶ $flds->{id } = $has->{pid } ? $p->pid : NUL;
Branch: 1 branch
BranchTrueFalseTotal
$has->{'pid'} ? : 0 0 0
59 0 ▶ $flds->{pid } = $has->{pid } ? $p->pid : NUL;
Branch: 1 branch
BranchTrueFalseTotal
$has->{'pid'} ? : 0 0 0
60 0 ▶ $flds->{ppid } = $has->{ppid } ? $p->ppid : NUL;
Branch: 1 branch
BranchTrueFalseTotal
$has->{'ppid'} ? : 0 0 0
61 0 ▶ $flds->{start} = $has->{start } ? time2str( '%d/%m %H:%M', $p->start ) : NUL;
Branch: 1 branch
BranchTrueFalseTotal
$has->{'start'} ? : 0 0 0
62 0 ▶ $flds->{state} = $has->{state } ? $p->state : NUL;
Branch: 1 branch
BranchTrueFalseTotal
$has->{'state'} ? : 0 0 0
63 0 ▶ $flds->{tty } = $has->{ttydev} ? $p->ttydev : NUL;
Branch: 1 branch
BranchTrueFalseTotal
$has->{'ttydev'} ? : 0 0 0
64 0 ▶ $flds->{time } = $has->{time } ? int $p->time / 1_000_000 : NUL;
Branch: 1 branch
BranchTrueFalseTotal
$has->{'time'} ? : 0 0 0
65 0 ▶ $flds->{uid } = $has->{uid } ? getpwuid $p->uid : NUL;
Branch: 1 branch
BranchTrueFalseTotal
$has->{'uid'} ? : 0 0 0
66  
67 0 ▶ if ($has->{ttydev} and $p->ttydev) {
Branch: 2 branches
BranchTrueFalseTotal
if ($has->{'ttydev'} and $p->ttydev) { } 0 0 0
elsif ($has->{'ttynum'} and $p->ttynum) { } 0 0 0
Condition0%0/3
$has->{"ttydev"} and $p->ttydev
!ll&&!rl&&r
000
MC/DC0%0/2
$has->{"ttydev"} and $p->ttydev
$has->{"ttydev"} $p->ttydev
Truth table0%0/3
A and B
A= $has->{"ttydev"}B= $p->ttydev
ABresult
0X0
100
111
68 0 $flds->{tty} = $p->ttydev;
69 }
70 ▶ elsif ($has->{ttynum} and $p->ttynum) {
Condition0%0/3
$has->{"ttynum"} and $p->ttynum
!ll&&!rl&&r
000
MC/DC0%0/2
$has->{"ttynum"} and $p->ttynum
$has->{"ttynum"} $p->ttynum
Truth table0%0/3
A and B
A= $has->{"ttynum"}B= $p->ttynum
ABresult
0X0
100
111
71 0 $flds->{tty} = $p->ttynum;
72 }
73 0 else { $flds->{tty} = NUL }
74  
75 0 ▶ if ($has->{rss} and $p->rss) {
Branch: 2 branches
BranchTrueFalseTotal
if ($has->{'rss'} and $p->rss) { } 0 0 0
elsif ($has->{'size'} and $p->size) { } 0 0 0
Condition0%0/3
$has->{"rss"} and $p->rss
!ll&&!rl&&r
000
MC/DC0%0/2
$has->{"rss"} and $p->rss
$has->{"rss"} $p->rss
Truth table0%0/3
A and B
A= $has->{"rss"}B= $p->rss
ABresult
0X0
100
111
76 0 $flds->{size} = int $p->rss/1_024;
77 }
78 ▶ elsif ($has->{size} and $p->size) {
Condition0%0/3
$has->{"size"} and $p->size
!ll&&!rl&&r
000
MC/DC0%0/2
$has->{"size"} and $p->size
$has->{"size"} $p->size
Truth table0%0/3
A and B
A= $has->{"size"}B= $p->size
ABresult
0X0
100
111
79 0 $flds->{size} = int $p->size/1_024;
80 }
81 0 else { $flds->{size} = NUL }
82  
83 0 ▶ if ($has->{exec} and $p->exec) {
Branch: 3 branches
BranchTrueFalseTotal
if ($has->{'exec'} and $p->exec) { } 0 0 0
elsif ($has->{'cmndline'} and $p->cmndline) { } 0 0 0
elsif ($has->{'fname'} and $p->fname) { } 0 0 0
Condition0%0/3
$has->{"exec"} and $p->exec
!ll&&!rl&&r
000
MC/DC0%0/2
$has->{"exec"} and $p->exec
$has->{"exec"} $p->exec
Truth table0%0/3
A and B
A= $has->{"exec"}B= $p->exec
ABresult
0X0
100
111
84 0 $flds->{cmd} = substr $p->exec, 0, 64;
85 }
86 ▶ elsif ($has->{cmndline} and $p->cmndline) {
Condition0%0/3
$has->{"cmndline"} and $p->cmndline
!ll&&!rl&&r
000
MC/DC0%0/2
$has->{"cmndline"} and $p->cmndline
$has->{"cmndline"} $p->cmndline
Truth table0%0/3
A and B
A= $has->{"cmndline"}B= $p->cmndline
ABresult
0X0
100
111
87 0 $flds->{cmd} = substr $p->cmndline, 0, 64;
88 }
89 ▶ elsif ($has->{fname} and $p->fname) {
Condition0%0/3
$has->{"fname"} and $p->fname
!ll&&!rl&&r
000
MC/DC0%0/2
$has->{"fname"} and $p->fname
$has->{"fname"} $p->fname
Truth table0%0/3
A and B
A= $has->{"fname"}B= $p->fname
ABresult
0X0
100
111
90 0 $flds->{cmd} = substr $p->fname, 0, 64;
91 }
92 0 else { $flds->{cmd} = NUL }
93  
94 0 return $flds;
95 17 };
96  
97 0 ▶my $_signal_cmd = sub {
Subroutine __ANON__: not called CC=4 SCAR=30.0
98 0 my ($cmd, $flag, $sig, $pids) = @_; my $opts = [];
99  
100 0 ▶ $sig and push @{ $opts }, '-o', "sig=${sig}";
Branch: 1 branch
BranchTrueFalseTotal
$sig and push @{$opts;}, "-o", "sig=$sig" 0 0 0
101 0 ▶ $flag and push @{ $opts }, '-o', 'flag=one';
Branch: 1 branch
BranchTrueFalseTotal
$flag and push @{$opts;}, "-o", "flag=one" 0 0 0
102  
103 0 ▶ return [ $cmd, '-nc', 'signal_process', @{ $opts }, '--', @{ $pids || [] } ];
Condition0%0/2
$pids || []
l!l
00
MC/DC0%0/1
$pids || []
$pids
Truth table0%0/2
A
A= $pids
Aresult
11
00
104 17 };
105  
106 # Construction
107 13 ▶around 'BUILDARGS' => sub {
Subroutine __ANON__: called CC=2 SCAR=7.0
108 13 my ($orig, $self, @args) = @_; my $attr = $orig->( $self, @args );
109  
110 13 ▶ my $builder = $attr->{builder} or return $attr;
Branch: 1 branch
BranchTrueFalseTotal
my $builder = $attr->{"builder"} or return $attr 13 0 13
111  
112 13 merge_attributes $attr, $builder, [ 'config', 'log' ];
113  
114 13 return $attr;
115 17 };
116  
117 0 ▶my $_new_process_table = sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
118 0 my ($self, $rows, $count) = @_;
119  
120 return {
121 0 count => $count,
122 fields => [ qw( uid pid ppid start time size state tty cmd ) ],
123 labels => { uid => 'User', pid => 'PID',
124 ppid => 'PPID', start => 'Start Time',
125 tty => 'TTY', time => 'Time',
126 size => 'Size', state => 'State',
127 cmd => 'Command' },
128 typelist => { pid => 'numeric', ppid => 'numeric',
129 start => 'date', size => 'numeric',
130 time => 'numeric' },
131 values => $rows,
132 wrap => { cmd => 1 },
133 };
134 17 };
135  
136 # Public methods
137 0 ▶sub child_list {
Subroutine child_list: not called CC=4 SCAR=30.0
Pod documented
138 0 my ($self, $pid, $procs) = @_; my ($child, $ppt); my @pids = ();
139  
140 0 ▶ unless (defined $procs) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $procs) 0 0 0
141 0 $ppt = $_new_proc_process_table->( $self->cache_ttys );
142 0 $procs = { map { $_->pid => $_->ppid } @{ $ppt->table } };
143 }
144  
145 0 ▶ if (exists $procs->{ $pid }) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $procs->{$pid}) 0 0 0
146 0 for $child (grep { $procs->{ $_ } == $pid } keys %{ $procs }) {
147 0 push @pids, $self->child_list( $child, $procs ); # Recurse
148 }
149  
150 0 push @pids, $pid;
151 }
152  
153 0 return sort { $a <=> $b } @pids;
154 }
155  
156 0 ▶sub list_pids_by_file_system {
Subroutine list_pids_by_file_system: not called CC=4 SCAR=30.0
Pod documented
157 0 ▶ my ($self, $fsystem) = @_; $fsystem or return ();
Branch: 1 branch
BranchTrueFalseTotal
$fsystem or return () 0 0 0
158  
159 0 my $opts = { err => 'null', expected_rv => 1 };
160 # TODO: Make fuser OS dependent
161 0 ▶ my $data = $self->run_cmd( "fuser ${fsystem}", $opts )->out || NUL;
Condition0%0/2
$self->run_cmd("fuser $fsystem", $opts)->out || ''
l!l
00
MC/DC0%0/1
$self->run_cmd("fuser $fsystem", $opts)->out || ''
$self->run_cmd("fuser $fsystem", $opts)->out
Truth table0%0/2
A
A= $self->run_cmd("fuser $fsystem", $opts)->out
Aresult
11
00
162  
163 0 $data =~ s{ [^0-9\s] }{}gmx; $data =~ s{ \s+ }{ }gmx;
164  
165 0 ▶ return sort { $a <=> $b } grep { defined && length } split SPC, $data;
Condition0%0/3
defined $_ && length $_
!ll&&!rl&&r
000
MC/DC0%0/2
defined $_ && length $_
defined $_ length $_
Truth table0%0/3
A && B
A= defined $_B= length $_
ABresult
0X0
100
111
166 }
167  
168 91 ▶sub popen {
Subroutine popen: called CC=1 SCAR=0.0
Pod documented
169 91 return shift->run_cmd( @_ );
170 }
171  
172 0 ▶sub process_exists {
Subroutine process_exists: not called CC=7 SCAR=40.3
Pod documented
173 0 my ($self, @args) = @_; my $args = arg_list @args;
174  
175 0 my $pid = $args->{pid}; my ($io, $file);
176  
177 0 ▶ $file = $args->{file} and $io = io( $file ) and $io->is_file
Branch: 1 branch
BranchTrueFalseTotal
$file = $args->{"file"} and $io = &io($file) and $io->is_file and $pid = $io->chomp->lock->getline 0 0 0
Condition0%0/6
$file = $args->{"file"} and $io = &io($file) and $io->is_file
!ll&&!rl&&r
000
$file = $args->{"file"} and $io = &io($file)
!ll&&!rl&&r
000
MC/DC0%0/3
$file = $args->{"file"} and $io = &io($file) and $io->is_file
$file = $args->{"file"} $io = &io($file) $io->is_file
Truth table0%0/4
A and B and C
A= $file = $args->{"file"}B= $io = &io($file)C= $io->is_file
ABCresult
0XX0
10X0
1100
1111
178 and $pid = $io->chomp->lock->getline;
179  
180 0 ▶ (not $pid or $pid !~ m{ \d+ }mx) and return FALSE;
Branch: 1 branch
BranchTrueFalseTotal
$pid and $pid =~ / \d+ /mx or return 0 0 0 0
Condition0%0/3
$pid and $pid =~ / \d+ /mx
!ll&&!rl&&r
000
MC/DC0%0/2
$pid and $pid =~ / \d+ /mx
$pid $pid =~ / \d+ /mx
Truth table0%0/3
A and B
A= $pidB= $pid =~ / \d+ /mx
ABresult
0X0
100
111
181  
182 0 ▶ return (CORE::kill 0, $pid) ? TRUE : FALSE;
Branch: 1 branch
BranchTrueFalseTotal
kill(0, $pid) ? : 0 0 0
183 }
184  
185 0 ▶sub process_table {
Subroutine process_table: not called CC=10 SCAR=47.0
Pod documented
186 0 my ($self, @args) = @_; my $args = arg_list @args;
187  
188 0 my $pat = $args->{pattern};
189 0 ▶ my $ptype = $args->{type } // 1;
Condition0%0/2
$args->{"type"} // 1
l!l
00
MC/DC0%0/1
$args->{"type"} // 1
$args->{"type"}
Truth table0%0/2
A
A= $args->{"type"}
Aresult
11
00
190 0 ▶ my $user = $args->{user } // get_user->name;
Condition0%0/3
$args->{"user"} // &get_user()->name
l!l&&r!l&&!r
000
MC/DC0%0/2
$args->{"user"} // &get_user()->name
$args->{"user"} &get_user()->name
Truth table0%0/3
A // B
A= $args->{"user"}B= &get_user()->name
ABresult
1X1
011
000
191 0 my $ppt = $_new_proc_process_table->( $self->cache_ttys );
192 0 my $has = { map { $_ => TRUE } $ppt->fields };
193 0 my @rows = ();
194 0 my $count = 0;
195  
196 0 ▶ if ($ptype == 3) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ptype == 3) { } 0 0 0
197 0 my %procs = map { $_->pid => $_ } @{ $ppt->table };
198 0 my @pids = $self->list_pids_by_file_system( $args->{fsystem} );
199  
200 0 for my $p (grep { defined } map { $procs{ $_ } } @pids) {
201 0 push @rows, $_set_fields->( $has, $p );
202 0 $count++;
203 }
204 }
205 else {
206 0 for my $p (@{ $ppt->table }) {
207 0 ▶ if ( ($ptype == 1 and $_proc_belongs_to_user->( $p->uid, $user ))
Branch: 1 branch
BranchTrueFalseTotal
if ($ptype == 1 and &$_proc_belongs_to_user($p->uid, $user) or $ptype == 2 and &$_cmd_matches($p->cmndline, $pat)) 0 0 0
Condition0%0/9
$ptype == 1 and &$_proc_belongs_to_user($p->uid, $user) or $ptype == 2 and &$_cmd_matches($p->cmndline, $pat)
l!l&&r!l&&!r
000
$ptype == 1 and &$_proc_belongs_to_user($p->uid, $user)
!ll&&!rl&&r
000
$ptype == 2 and &$_cmd_matches($p->cmndline, $pat)
!ll&&!rl&&r
000
MC/DC0%0/4
$ptype == 1 and &$_proc_belongs_to_user($p->uid, $user) or $ptype == 2 and &$_cmd_matches($p->cmndline, $pat)
$ptype == 1 &$_proc_belongs_to_user($p->uid, $user) $ptype == 2 &$_cmd_matches($p->cmndline, $pat)
Truth table0%0/7
A and B or C and D
A= $ptype == 1B= &$_proc_belongs_to_user($p->uid, $user)C= $ptype == 2D= &$_cmd_matches($p->cmndline, $pat)
ABCDresult
11XX1
0X111
10111
0X0X0
0X100
100X0
10100
208 or ($ptype == 2 and $_cmd_matches->( $p->cmndline, $pat ))) {
209 0 push @rows, $_set_fields->( $has, $p );
210 0 $count++;
211 }
212 }
213 }
214  
215 return $self->$_new_process_table
216 0 ( [ sort { $_pscomp->( $a, $b ) } @rows ], $count );
217 }
218  
219 356 ▶sub run_cmd {
Subroutine run_cmd: called CC=2 SCAR=7.0
Pod documented
220 356 my ($self, $cmd, @args) = @_; my $attr = arg_list @args;
221  
222 356 ▶ $attr->{cmd } = $cmd or throw Unspecified, [ 'command' ];
Branch: 1 branch
BranchTrueFalseTotal
$attr->{"cmd"} = $cmd or &throw(Unspecified(), ["command"]) 356 0 356
223 356 $attr->{log } = $self->log;
224 356 $attr->{rundir } = $self->config->rundir;
225 356 $attr->{tempdir} = $self->config->tempdir;
226  
227 356 return Class::Usul::IPC::Cmd->new( $attr )->run_cmd;
228 }
229  
230 0 ▶sub signal_process {
Subroutine signal_process: not called CC=17 SCAR=57.2
Pod documented
231 0 my ($self, @args) = @_;
232  
233 0 ▶ is_hashref $args[ 0 ]
Branch: 1 branch
BranchTrueFalseTotal
@args->is_hashref([0]) or return $self->run_cmd(&$_signal_cmd($self->config->suid, @args)) 0 0 0
234 or return $self->run_cmd( $_signal_cmd->( $self->config->suid, @args ) );
235  
236 0 my ($file, $io); my $args = $args[ 0 ];
237  
238 0 ▶ my $sig = $args->{sig} // 'TERM'; my $pids = $args->{pids} // [];
Condition0%0/4
$args->{"sig"} // "TERM"
l!l
00
$args->{"pids"} // []
l!l
00
MC/DC0%0/1
$args->{"sig"} // "TERM"
$args->{"sig"}
MC/DC0%0/1
$args->{"pids"} // []
$args->{"pids"}
Truth table0%0/2
A
A= $args->{"sig"}
Aresult
11
00
Truth table0%0/2
A
A= $args->{"pids"}
Aresult
11
00
239  
240 0 ▶ $args->{pid} and push @{ $pids }, $args->{pid};
Branch: 1 branch
BranchTrueFalseTotal
$args->{"pid"} and push @{$pids;}, $args->{"pid"} 0 0 0
241  
242 0 ▶ if ($file = $args->{file} and $io = io( $file ) and $io->is_file) {
Branch: 1 branch
BranchTrueFalseTotal
if ($file = $args->{"file"} and $io = &io($file) and $io->is_file) 0 0 0
Condition0%0/6
$file = $args->{"file"} and $io = &io($file) and $io->is_file
!ll&&!rl&&r
000
$file = $args->{"file"} and $io = &io($file)
!ll&&!rl&&r
000
MC/DC0%0/3
$file = $args->{"file"} and $io = &io($file) and $io->is_file
$file = $args->{"file"} $io = &io($file) $io->is_file
Truth table0%0/4
A and B and C
A= $file = $args->{"file"}B= $io = &io($file)C= $io->is_file
ABCresult
0XX0
10X0
1100
1111
243 0 push @{ $pids }, $io->chomp->lock->getlines;
244 0 ▶ $sig eq 'TERM' and unlink $file;
Branch: 1 branch
BranchTrueFalseTotal
$sig eq "TERM" and unlink $file 0 0 0
245 }
246  
247 0 ▶ (defined $pids->[0] and $pids->[0] =~ m{ \d+ }mx) or throw 'Process id bad';
Branch: 1 branch
BranchTrueFalseTotal
defined $pids->[0] and $pids->[0] =~ / \d+ /mx or &throw("Process id bad") 0 0 0
Condition0%0/3
defined $pids->[0] and $pids->[0] =~ / \d+ /mx
!ll&&!rl&&r
000
MC/DC0%0/2
defined $pids->[0] and $pids->[0] =~ / \d+ /mx
defined $pids->[0] $pids->[0] =~ / \d+ /mx
Truth table0%0/3
A and B
A= defined $pids->[0]B= $pids->[0] =~ / \d+ /mx
ABresult
0X0
100
111
248  
249 0 for my $mpid (@{ $pids }) {
250 0 ▶ if (exists $args->{flag} and $args->{flag} =~ m{ one }imx) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $args->{"flag"} and $args->{"flag"} =~ / one /mix) 0 0 0
Condition0%0/3
exists $args->{"flag"} and $args->{"flag"} =~ / one /mix
!ll&&!rl&&r
000
MC/DC0%0/2
exists $args->{"flag"} and $args->{"flag"} =~ / one /mix
exists $args->{"flag"} $args->{"flag"} =~ / one /mix
Truth table0%0/3
A and B
A= exists $args->{"flag"}B= $args->{"flag"} =~ / one /mix
ABresult
0X0
100
111
251 0 CORE::kill $sig, $mpid; next;
252 }
253  
254 0 my @pids = reverse $self->child_list( $mpid );
255  
256 0 CORE::kill $sig, $_ for (@pids);
257  
258 0 ▶ $args->{force} or next;
Branch: 1 branch
BranchTrueFalseTotal
$args->{"force"} or next 0 0 0
259  
260 0 sleep 3; @pids = reverse $self->child_list( $mpid );
261  
262 0 CORE::kill 'KILL', $_ for (@pids);
263 }
264  
265 0 return OK;
266 }
267  
268 0 ▶sub signal_process_as_root {
Subroutine signal_process_as_root: not called CC=1 SCAR=6.9
Pod documented
269 0 my ($self, @args) = @_; return $self->signal_process( arg_list @args );
270 }
271  
272 17 1;
273  
274 __END__
« Usul/Time.pm ↑ Summary Usul/TraitFor/Prompting.pm »