line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Proc::Lite; |
2
|
|
|
|
|
|
|
|
3
|
9
|
|
|
9
|
|
182745
|
use strict; |
|
9
|
|
|
|
|
22
|
|
|
9
|
|
|
|
|
308
|
|
4
|
9
|
|
|
9
|
|
54
|
use warnings; |
|
9
|
|
|
|
|
21
|
|
|
9
|
|
|
|
|
251
|
|
5
|
|
|
|
|
|
|
|
6
|
9
|
|
|
9
|
|
43
|
use Carp; |
|
9
|
|
|
|
|
21
|
|
|
9
|
|
|
|
|
583
|
|
7
|
9
|
|
|
9
|
|
33735
|
use Proc::Hevy; |
|
9
|
|
|
|
|
29
|
|
|
9
|
|
|
|
|
3919
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our $VERSION = '0.10'; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub new { |
13
|
29
|
|
|
29
|
1
|
13641
|
my ( $class, @args ) = @_; |
14
|
|
|
|
|
|
|
|
15
|
29
|
100
|
|
|
|
1350
|
confess 'Odd number of parameters' |
16
|
|
|
|
|
|
|
unless @args % 2 == 0; |
17
|
24
|
|
|
|
|
151
|
my %args = @args; |
18
|
|
|
|
|
|
|
|
19
|
24
|
100
|
|
|
|
816
|
confess 'command: Required parameter' |
20
|
|
|
|
|
|
|
unless defined $args{command}; |
21
|
|
|
|
|
|
|
|
22
|
19
|
|
|
|
|
485
|
bless { |
23
|
|
|
|
|
|
|
command => $args{command}, |
24
|
|
|
|
|
|
|
stdin => $args{stdin}, |
25
|
|
|
|
|
|
|
stdout => [ ], |
26
|
|
|
|
|
|
|
stderr => [ ], |
27
|
|
|
|
|
|
|
status => undef, |
28
|
|
|
|
|
|
|
parent => $args{parent}, |
29
|
|
|
|
|
|
|
child => $args{child}, |
30
|
|
|
|
|
|
|
priority => $args{priority}, |
31
|
|
|
|
|
|
|
}, $class |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub exec { |
35
|
9
|
|
|
9
|
1
|
2787
|
my ( $class, @command ) = @_; |
36
|
9
|
|
|
|
|
67
|
$class->new( command => \@command )->run; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub run { |
40
|
19
|
|
|
19
|
1
|
43
|
my ( $self ) = @_; |
41
|
|
|
|
|
|
|
|
42
|
19
|
|
|
|
|
272
|
my $status = Proc::Hevy->exec( |
43
|
|
|
|
|
|
|
command => $self->{command}, |
44
|
|
|
|
|
|
|
stdin => $self->{stdin}, |
45
|
|
|
|
|
|
|
stdout => $self->{stdout}, |
46
|
|
|
|
|
|
|
stderr => $self->{stderr}, |
47
|
|
|
|
|
|
|
parent => $self->{parent}, |
48
|
|
|
|
|
|
|
child => $self->{child}, |
49
|
|
|
|
|
|
|
priority => $self->{priority}, |
50
|
|
|
|
|
|
|
); |
51
|
|
|
|
|
|
|
|
52
|
12
|
|
|
|
|
63
|
$self->{status} = $status >> 8; |
53
|
|
|
|
|
|
|
|
54
|
12
|
|
|
|
|
164
|
$self |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
9
|
|
|
9
|
1
|
70
|
sub status { my ( $self ) = @_; $self->{status} } |
|
9
|
|
|
|
|
110
|
|
58
|
|
|
|
|
|
|
|
59
|
11
|
100
|
|
11
|
1
|
266
|
sub stdout { my ( $self ) = @_; wantarray ? @{ $self->{stdout} } : $self->{stdout} } |
|
11
|
|
|
|
|
175
|
|
|
4
|
|
|
|
|
61
|
|
60
|
|
|
|
|
|
|
|
61
|
9
|
100
|
|
9
|
1
|
139
|
sub stderr { my ( $self ) = @_; wantarray ? @{ $self->{stderr} } : $self->{stderr} } |
|
9
|
|
|
|
|
95
|
|
|
4
|
|
|
|
|
45
|
|
62
|
|
|
|
|
|
|
|
63
|
4
|
|
|
4
|
1
|
28
|
sub success { my ( $self ) = @_; $self->status == 0 } |
|
4
|
|
|
|
|
16
|
|
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
1 |
67
|
|
|
|
|
|
|
__END__ |