| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Proc::ChildError; |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
our $DATE = '2016-01-06'; # DATE |
|
4
|
|
|
|
|
|
|
our $VERSION = '0.04'; # VERSION |
|
5
|
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
20443
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
25
|
|
|
7
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
279
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
require Exporter; |
|
10
|
|
|
|
|
|
|
our @ISA = qw(Exporter); |
|
11
|
|
|
|
|
|
|
our @EXPORT_OK = qw(explain_child_error); |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub explain_child_error { |
|
14
|
6
|
|
|
6
|
1
|
20
|
my $opts; |
|
15
|
6
|
100
|
|
|
|
23
|
if (ref($_[0]) eq 'HASH') { |
|
16
|
1
|
|
|
|
|
2
|
$opts = shift; |
|
17
|
|
|
|
|
|
|
} else { |
|
18
|
5
|
|
|
|
|
13
|
$opts = {}; |
|
19
|
|
|
|
|
|
|
} |
|
20
|
|
|
|
|
|
|
|
|
21
|
6
|
|
|
|
|
11
|
my ($num, $str); |
|
22
|
6
|
100
|
|
|
|
16
|
if (defined $_[0]) { |
|
23
|
5
|
|
|
|
|
6
|
$num = $_[0]; |
|
24
|
5
|
|
|
|
|
9
|
$str = $_[1]; |
|
25
|
|
|
|
|
|
|
} else { |
|
26
|
1
|
|
|
|
|
18
|
$num = $?; |
|
27
|
1
|
|
|
|
|
26
|
$str = $!; |
|
28
|
|
|
|
|
|
|
} |
|
29
|
|
|
|
|
|
|
|
|
30
|
6
|
|
|
|
|
12
|
my $prefix = ""; |
|
31
|
6
|
100
|
|
|
|
21
|
if (defined $opts->{prog}) { |
|
32
|
1
|
|
|
|
|
5
|
$prefix = "$opts->{prog} "; |
|
33
|
|
|
|
|
|
|
} |
|
34
|
|
|
|
|
|
|
|
|
35
|
6
|
100
|
|
|
|
23
|
if ($num == -1) { |
|
|
|
100
|
|
|
|
|
|
|
36
|
2
|
100
|
|
|
|
65
|
return "${prefix}failed to execute: ".($str ? "$str ":"")."($num)"; |
|
37
|
|
|
|
|
|
|
} elsif ($num & 127) { |
|
38
|
2
|
100
|
|
|
|
27
|
return sprintf( |
|
39
|
|
|
|
|
|
|
"${prefix}died with signal %d, %s coredump", |
|
40
|
|
|
|
|
|
|
($num & 127), |
|
41
|
|
|
|
|
|
|
(($num & 128) ? 'with' : 'without')); |
|
42
|
|
|
|
|
|
|
} else { |
|
43
|
2
|
|
|
|
|
19
|
return sprintf("${prefix}exited with code %d", $num >> 8); |
|
44
|
|
|
|
|
|
|
} |
|
45
|
|
|
|
|
|
|
} |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
1; |
|
48
|
|
|
|
|
|
|
# ABSTRACT: Explain process child error |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
__END__ |