Callback/CommandFailedException.pm

filter: Statementstmt 40.0% 16 / 40 Branchbran 0.0% 0 / 10 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 57.1% 4 / 7 Podpod 100% 2 / 2 totaltotal 37.2% 22 / 59 CC 6 SCAR 23.2
CC
6
Cov
32%
to_string
20.0
_init
12.0
new
2.0
CRAP 10.2
« Callback/Command.pm ↑ Summary Callback/Logger.pm »
1 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 package IPC::Open3::Callback::CommandFailedException;
5 1 $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 ▶use overload q{""} => 'to_string', fallback => 1;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 ▶use parent qw(Class::Accessor);
Subroutine BEGIN: called CC=1 SCAR=0.0
11 1 __PACKAGE__->follow_best_practice;
12 1 __PACKAGE__->mk_ro_accessors(qw(command exit_status out err));
13  
14 0 ▶sub new {
Subroutine new: not called CC=1 SCAR=6.9
Pod documented
15 0 my ( $class, @args ) = @_;
16 0 return bless( {}, $class )->_init(@args);
17 }
18  
19 0 ▶sub _init {
Subroutine _init: not called CC=3 SCAR=24.8
20 0 my ( $self, $command, $exit_status, $out, $err ) = @_;
21  
22 0 $self->{command} = $command;
23 0 $self->{exit_status} = $exit_status;
24 0 ▶ if ( defined($out) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $out) 0 0 0
25 0 $out =~ s/^\s+//;
26 0 $out =~ s/\s+$//;
27 0 $self->{out} = $out;
28 }
29 0 ▶ if ( defined($err) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $err) 0 0 0
30 0 $err =~ s/^\s+//;
31 0 $err =~ s/\s+$//;
32 0 $self->{err} = $err;
33 }
34  
35 0 return $self;
36 }
37  
38 0 ▶sub to_string {
Subroutine to_string: not called CC=4 SCAR=30.0
Pod documented
39 0 my ($self) = @_;
40 0 ▶ if ( !$self->{message} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->{"message"}) 0 0 0
41 0 my @message = ( 'FAILED (', $self->{exit_status}, '): ', @{ $self->{command} } );
42 0 ▶ if ( $self->{out} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"out"}) 0 0 0
43 0 push( @message, "\n***** out *****\n", $self->{out}, "\n***** end out *****" );
44 }
45 0 ▶ if ( $self->{err} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"err"}) 0 0 0
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 1;
54  
55 __END__
« Callback/Command.pm ↑ Summary Callback/Logger.pm »