line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
24
|
|
2
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
55
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
package IPC::Open3::Callback::CommandFailedException; |
5
|
|
|
|
|
|
|
$IPC::Open3::Callback::CommandFailedException::VERSION = '1.19'; |
6
|
|
|
|
|
|
|
# ABSTRACT: An exception thrown when run_or_die encounters a failed command |
7
|
|
|
|
|
|
|
# PODNAME: IPC::Open3::Callback::CommandFailedException |
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
6
|
use overload q{""} => 'to_string', fallback => 1; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
9
|
|
10
|
1
|
|
|
1
|
|
82
|
use parent qw(Class::Accessor); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
7
|
|
11
|
|
|
|
|
|
|
__PACKAGE__->follow_best_practice; |
12
|
|
|
|
|
|
|
__PACKAGE__->mk_ro_accessors(qw(command exit_status out err)); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub new { |
15
|
0
|
|
|
0
|
1
|
|
my ( $class, @args ) = @_; |
16
|
0
|
|
|
|
|
|
return bless( {}, $class )->_init(@args); |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub _init { |
20
|
0
|
|
|
0
|
|
|
my ( $self, $command, $exit_status, $out, $err ) = @_; |
21
|
|
|
|
|
|
|
|
22
|
0
|
|
|
|
|
|
$self->{command} = $command; |
23
|
0
|
|
|
|
|
|
$self->{exit_status} = $exit_status; |
24
|
0
|
0
|
|
|
|
|
if ( defined($out) ) { |
25
|
0
|
|
|
|
|
|
$out =~ s/^\s+//; |
26
|
0
|
|
|
|
|
|
$out =~ s/\s+$//; |
27
|
0
|
|
|
|
|
|
$self->{out} = $out; |
28
|
|
|
|
|
|
|
} |
29
|
0
|
0
|
|
|
|
|
if ( defined($err) ) { |
30
|
0
|
|
|
|
|
|
$err =~ s/^\s+//; |
31
|
0
|
|
|
|
|
|
$err =~ s/\s+$//; |
32
|
0
|
|
|
|
|
|
$self->{err} = $err; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
0
|
|
|
|
|
|
return $self; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub to_string { |
39
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
40
|
0
|
0
|
|
|
|
|
if ( !$self->{message} ) { |
41
|
0
|
|
|
|
|
|
my @message = ( 'FAILED (', $self->{exit_status}, '): ', @{ $self->{command} } ); |
|
0
|
|
|
|
|
|
|
42
|
0
|
0
|
|
|
|
|
if ( $self->{out} ) { |
43
|
0
|
|
|
|
|
|
push( @message, "\n***** out *****\n", $self->{out}, "\n***** end out *****" ); |
44
|
|
|
|
|
|
|
} |
45
|
0
|
0
|
|
|
|
|
if ( $self->{err} ) { |
46
|
0
|
|
|
|
|
|
push( @message, "\n***** err *****\n", $self->{err}, "\n***** end err *****" ); |
47
|
|
|
|
|
|
|
} |
48
|
0
|
|
|
|
|
|
$self->{message} = join( '', @message ); |
49
|
|
|
|
|
|
|
} |
50
|
0
|
|
|
|
|
|
return $self->{message}; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
1; |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
__END__ |