line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Shell::Autobox; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
143647
|
use strict; |
|
2
|
|
|
|
|
11
|
|
|
2
|
|
|
|
|
57
|
|
4
|
2
|
|
|
2
|
|
10
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
50
|
|
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
10
|
use base qw(autobox); |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
1093
|
|
7
|
|
|
|
|
|
|
|
8
|
2
|
|
|
2
|
|
21647
|
use Carp qw(confess); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
97
|
|
9
|
2
|
|
|
2
|
|
1118
|
use IPC::Run3 qw(run3); |
|
2
|
|
|
|
|
69552
|
|
|
2
|
|
|
|
|
118
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
# XXX this declaration must be on a single line |
12
|
|
|
|
|
|
|
# https://metacpan.org/pod/version#How-to-declare()-a-dotted-decimal-version |
13
|
2
|
|
|
2
|
|
16
|
use version; our $VERSION = version->declare('v1.0.1'); |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
13
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub import { |
16
|
2
|
|
|
2
|
|
18
|
my $class = shift; |
17
|
2
|
|
|
|
|
6
|
my $caller = (caller)[0]; |
18
|
|
|
|
|
|
|
|
19
|
2
|
|
|
|
|
12
|
for my $program (@_) { |
20
|
|
|
|
|
|
|
my $sub = sub { |
21
|
18
|
|
|
18
|
|
3540
|
my $input = shift; |
22
|
18
|
|
|
|
|
185
|
my $args = join ' ', @_; |
23
|
18
|
100
|
|
|
|
173
|
my $maybe_args = length($args) ? " $args" : ''; |
24
|
18
|
|
|
|
|
175
|
my $command = "$program$maybe_args"; |
25
|
18
|
50
|
33
|
|
|
273
|
my $stdin = (defined($input) && length($input)) ? \$input : undef; |
26
|
|
|
|
|
|
|
|
27
|
18
|
|
|
|
|
122
|
run3($command, $stdin, \my $stdout, \my $stderr, { |
28
|
|
|
|
|
|
|
return_if_system_error => 1, |
29
|
|
|
|
|
|
|
}); |
30
|
|
|
|
|
|
|
|
31
|
18
|
100
|
66
|
|
|
124128
|
my $error = (defined($stderr) && $stderr =~ /\S/) ? ": $stderr" : ''; |
32
|
18
|
|
|
|
|
204
|
my $message = "$command$error"; |
33
|
|
|
|
|
|
|
|
34
|
18
|
100
|
|
|
|
374
|
if ($?) { |
|
|
100
|
|
|
|
|
|
35
|
4
|
|
|
|
|
1884
|
confess "can't exec $message"; |
36
|
|
|
|
|
|
|
} elsif ($error) { |
37
|
4
|
|
|
|
|
113
|
warn "error running $message"; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
14
|
100
|
66
|
|
|
4581
|
return (defined($stdout) && length($stdout)) ? $stdout : ''; |
41
|
1
|
|
|
|
|
5
|
}; |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
{ |
44
|
2
|
|
|
2
|
|
583
|
no strict 'refs'; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
211
|
|
|
1
|
|
|
|
|
2
|
|
45
|
1
|
|
|
|
|
2
|
*{"$caller\::$program"} = $sub; |
|
1
|
|
|
|
|
16
|
|
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
2
|
|
|
|
|
16
|
$class->SUPER::import(SCALAR => $caller); |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
1; |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
__END__ |