| 1 | package Proc::Lite; | ||||||||||
| 2 | |||||||||||
| 3 | 9 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 9 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | 9 | ▶ | use Carp; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 9 | ▶ | use Proc::Hevy; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | |||||||||||
| 9 | 9 | our $VERSION = '0.10'; | |||||||||
| 10 | |||||||||||
| 11 | |||||||||||
| 12 | 29 | ▶ | sub new { | ||||||||
|
Subroutine
new: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||
| 13 | 29 | my ( $class, @args ) = @_; | |||||||||
| 14 | |||||||||||
| 15 | 29 | ▶ | confess 'Odd number of parameters' | ||||||||
|
Branch: 1 branch
| |||||||||||
| 16 | unless @args % 2 == 0; | ||||||||||
| 17 | 24 | my %args = @args; | |||||||||
| 18 | |||||||||||
| 19 | confess 'command: Required parameter' | ||||||||||
| 20 | 24 | ▶ | unless defined $args{command}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 21 | |||||||||||
| 22 | 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 | 19 | }, $class | |||||||||
| 32 | } | ||||||||||
| 33 | |||||||||||
| 34 | 9 | ▶ | sub exec { | ||||||||
|
Subroutine
exec: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 35 | 9 | my ( $class, @command ) = @_; | |||||||||
| 36 | 9 | $class->new( command => \@command )->run; | |||||||||
| 37 | } | ||||||||||
| 38 | |||||||||||
| 39 | 19 | ▶ | sub run { | ||||||||
|
Subroutine
run: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 40 | 19 | my ( $self ) = @_; | |||||||||
| 41 | |||||||||||
| 42 | 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 | 19 | ); | |||||||||
| 51 | |||||||||||
| 52 | 12 | $self->{status} = $status >> 8; | |||||||||
| 53 | |||||||||||
| 54 | 12 | $self | |||||||||
| 55 | } | ||||||||||
| 56 | |||||||||||
| 57 | 9 | ▶ | sub status { my ( $self ) = @_; $self->{status} } | ||||||||
|
Subroutine
status: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 58 | |||||||||||
| 59 | 11 | ▶ | sub stdout { my ( $self ) = @_; wantarray ? @{ $self->{stdout} } : $self->{stdout} } | ||||||||
|
Subroutine
stdout: called CC=2 SCAR=6.9
Pod
documented
Branch: 1 branch
| |||||||||||
| 60 | |||||||||||
| 61 | 9 | ▶ | sub stderr { my ( $self ) = @_; wantarray ? @{ $self->{stderr} } : $self->{stderr} } | ||||||||
|
Subroutine
stderr: called CC=2 SCAR=6.9
Pod
documented
Branch: 1 branch
| |||||||||||
| 62 | |||||||||||
| 63 | 4 | ▶ | sub success { my ( $self ) = @_; $self->status == 0 } | ||||||||
|
Subroutine
success: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 64 | |||||||||||
| 65 | |||||||||||
| 66 | 9 | 1 | |||||||||
| 67 | __END__ | ||||||||||