blib/lib/MooX/Ipc/Cmd/Exception.pm

filter: Statementstmt 96.1% 25 / 26 Branchbran 50.0% 2 / 4 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 4 / 4 Podpod n/a totaltotal 82.0% 32 / 39 SCAR 14.0
CC
4
Cov
85%
__ANON__
4.4
BEGIN
1.0
BEGIN
1.0
CRAP 4.1
« blib/lib/MooX/Ipc/Cmd.pm ↑ Summary
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
BranchTrueFalseTotal
if ($self->has_signal) { } 0 1 1
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
BranchTrueFalseTotal
if ($self->has_stderr and defined $self->stderr) 1 0 1
Condition33%1/3
$self->has_stderr and defined $self->stderr
!ll&&!rl&&r
001
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
ABresult
0X0
100
111
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__
« blib/lib/MooX/Ipc/Cmd.pm ↑ Summary