line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Shell::Autobox; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
144196
|
use strict; |
|
2
|
|
|
|
|
11
|
|
|
2
|
|
|
|
|
65
|
|
4
|
2
|
|
|
2
|
|
12
|
use warnings; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
62
|
|
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
10
|
use base qw(autobox); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
1164
|
|
7
|
|
|
|
|
|
|
|
8
|
2
|
|
|
2
|
|
22978
|
use Carp qw(confess); |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
125
|
|
9
|
2
|
|
|
2
|
|
1205
|
use IPC::Run3 qw(run3); |
|
2
|
|
|
|
|
72156
|
|
|
2
|
|
|
|
|
163
|
|
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
|
|
22
|
use version; our $VERSION = version->declare('v1.0.0'); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
17
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub import { |
16
|
2
|
|
|
2
|
|
22
|
my $class = shift; |
17
|
2
|
|
|
|
|
7
|
my $caller = (caller)[0]; |
18
|
|
|
|
|
|
|
|
19
|
2
|
|
|
|
|
14
|
for my $program (@_) { |
20
|
|
|
|
|
|
|
my $sub = sub { |
21
|
16
|
|
|
16
|
|
4806
|
my $input = shift; |
22
|
16
|
|
|
|
|
228
|
my $args = join ' ', @_; |
23
|
16
|
100
|
|
|
|
113
|
my $maybe_args = length($args) ? " $args" : ''; |
24
|
16
|
|
|
|
|
90
|
my $command = "$program$maybe_args"; |
25
|
16
|
50
|
33
|
|
|
267
|
my $stdin = (defined($input) && length($input)) ? \$input : undef; |
26
|
|
|
|
|
|
|
|
27
|
16
|
|
|
|
|
165
|
run3($command, $stdin, \my $stdout, \my $stderr, { |
28
|
|
|
|
|
|
|
return_if_system_error => 1, |
29
|
|
|
|
|
|
|
}); |
30
|
|
|
|
|
|
|
|
31
|
16
|
100
|
66
|
|
|
100901
|
my $error = (defined($stderr) && $stderr =~ /\S/) ? ": $stderr" : ''; |
32
|
16
|
|
|
|
|
190
|
my $message = "$command$error"; |
33
|
|
|
|
|
|
|
|
34
|
16
|
100
|
|
|
|
270
|
if ($?) { |
|
|
100
|
|
|
|
|
|
35
|
4
|
|
|
|
|
2444
|
confess "can't exec $message"; |
36
|
|
|
|
|
|
|
} elsif ($error) { |
37
|
4
|
|
|
|
|
111
|
warn "error running $message"; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
12
|
|
50
|
|
|
4703
|
return $stdout || ''; |
41
|
1
|
|
|
|
|
5
|
}; |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
{ |
44
|
2
|
|
|
2
|
|
621
|
no strict 'refs'; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
216
|
|
|
1
|
|
|
|
|
2
|
|
45
|
1
|
|
|
|
|
2
|
*{"$caller\::$program"} = $sub; |
|
1
|
|
|
|
|
6
|
|
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
2
|
|
|
|
|
22
|
$class->SUPER::import(SCALAR => $caller); |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
1; |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
__END__ |