| 1 | #ABSTRACT: Exception class for MooX::Ipc::Cmd role | ||||||||||||||||||||||||||||
| 2 | package MooX::Ipc::Cmd::Exception; | ||||||||||||||||||||||||||||
| 3 | 7 | ▶ | use Moo; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 7 | our $VERSION = '1.2.0'; #VERSION | |||||||||||||||||||||||||||
| 5 | 7 | extends 'Throwable::Error'; | |||||||||||||||||||||||||||
| 6 | 7 | has 'stderr' => (is => 'ro', predicate => 1,); | |||||||||||||||||||||||||||
| 7 | 7 | has 'cmd' => (is => 'ro', required => 1,); | |||||||||||||||||||||||||||
| 8 | 7 | has 'exit_status' => (is => 'ro', required => 1); | |||||||||||||||||||||||||||
| 9 | 7 | has 'signal' => (is => 'ro', predicate => 1,); | |||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | use overload | ||||||||||||||||||||||||||||
| 12 | 7 | q{""} => 'as_string', | |||||||||||||||||||||||||||
| 13 | 7 | ▶ | fallback => 1; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | has +stack_trace_args => ( | ||||||||||||||||||||||||||||
| 16 | is=>'ro', | ||||||||||||||||||||||||||||
| 17 | 27 | ▶ | default=>sub{return [ skip_frames=>5,ignore_package=>['MooX::Ipc::Cmd','MooX::Ipc::Cmd::Exception'] ]}, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 18 | 7 | ); | |||||||||||||||||||||||||||
| 19 | #message to print when dieing | ||||||||||||||||||||||||||||
| 20 | has +message => ( | ||||||||||||||||||||||||||||
| 21 | is =>'ro', | ||||||||||||||||||||||||||||
| 22 | lazy => 1, | ||||||||||||||||||||||||||||
| 23 | default => sub { | ||||||||||||||||||||||||||||
| 24 | 1 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=4 SCAR=14.8
| |||||||||||||||||||||||||||||
| 25 | 1 | my $str = join(" ", @{$self->cmd}); | |||||||||||||||||||||||||||
| 26 | 1 | ▶ | if ($self->has_signal) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 27 | { | ||||||||||||||||||||||||||||
| 28 | 0 | $str .= " failed with signal " . $self->signal; | |||||||||||||||||||||||||||
| 29 | } | ||||||||||||||||||||||||||||
| 30 | else | ||||||||||||||||||||||||||||
| 31 | { | ||||||||||||||||||||||||||||
| 32 | 1 | $str .= " failed with exit status " . $self->exit_status; | |||||||||||||||||||||||||||
| 33 | 1 | ▶ | if ($self->has_stderr && defined $self->stderr) | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$self->has_stderr and defined $self->stderr
MC/DC0%0/2
$self->has_stderr and defined $self->stderr
$self->has_stderr
defined $self->stderr
Truth table33%1/3
A and B
A= $self->has_stderrB= defined $self->stderr
| |||||||||||||||||||||||||||||
| 34 | { | ||||||||||||||||||||||||||||
| 35 | 1 | $str .= "\nSTDERR is :\n " . join("\n ", @{$self->stderr}); | |||||||||||||||||||||||||||
| 36 | } | ||||||||||||||||||||||||||||
| 37 | } | ||||||||||||||||||||||||||||
| 38 | 1 | return $str; | |||||||||||||||||||||||||||
| 39 | }, | ||||||||||||||||||||||||||||
| 40 | 7 | ); | |||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | 7 | 1; | |||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | __END__ | ||||||||||||||||||||||||||||