| 1 | package autodie::exception::system; | ||||||||||||
| 2 | 3 | ▶ | use 5.008; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 3 | 3 | ▶ | use strict; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 4 | 3 | ▶ | use warnings; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 5 | 3 | ▶ | use parent 'autodie::exception'; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 6 | 3 | ▶ | use Carp qw(croak); | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 7 | |||||||||||||
| 8 | 3 | our $VERSION = '2.37'; # VERSION: Generated by DZP::OurPkg:Version | |||||||||||
| 9 | |||||||||||||
| 10 | # ABSTRACT: Exceptions from autodying system(). | ||||||||||||
| 11 | |||||||||||||
| 12 | 3 | my $PACKAGE = __PACKAGE__; | |||||||||||
| 13 | |||||||||||||
| 14 | =head1 NAME | ||||||||||||
| 15 | |||||||||||||
| 16 | autodie::exception::system - Exceptions from autodying system(). | ||||||||||||
| 17 | |||||||||||||
| 18 | =head1 SYNOPSIS | ||||||||||||
| 19 | |||||||||||||
| 20 | eval { | ||||||||||||
| 21 | use autodie qw(system); | ||||||||||||
| 22 | |||||||||||||
| 23 | system($cmd, @args); | ||||||||||||
| 24 | |||||||||||||
| 25 | }; | ||||||||||||
| 26 | |||||||||||||
| 27 | if (my $E = $@) { | ||||||||||||
| 28 | say "Ooops! ",$E->caller," had problems: $@"; | ||||||||||||
| 29 | } | ||||||||||||
| 30 | |||||||||||||
| 31 | |||||||||||||
| 32 | =head1 DESCRIPTION | ||||||||||||
| 33 | |||||||||||||
| 34 | This is a L<autodie::exception> class for failures from the | ||||||||||||
| 35 | C<system> command. | ||||||||||||
| 36 | |||||||||||||
| 37 | Presently there is no way to interrogate an C<autodie::exception::system> | ||||||||||||
| 38 | object for the command, exit status, and other information you'd expect | ||||||||||||
| 39 | such an object to hold. The interface will be expanded to accommodate | ||||||||||||
| 40 | this in the future. | ||||||||||||
| 41 | |||||||||||||
| 42 | =cut | ||||||||||||
| 43 | |||||||||||||
| 44 | 2 | ▶ | sub _init { | ||||||||||
|
Subroutine
_init: called CC=2 SCAR=7.1
| |||||||||||||
| 45 | 2 | my ($this, %args) = @_; | |||||||||||
| 46 | |||||||||||||
| 47 | $this->{$PACKAGE}{message} = $args{message} | ||||||||||||
| 48 | 2 | ▶ | || croak "'message' arg not supplied to autodie::exception::system->new"; | ||||||||||
|
Condition50%1/2
$args{'message'} || croak(q['message' arg not supplied to autodie::exception::system->new])
MC/DC0%0/1
$args{'message'} || croak(q['message' arg not supplied to autodie::exception::system->new])
$args{'message'}
Truth table50%1/2
A
A= $args{'message'}
| |||||||||||||
| 49 | |||||||||||||
| 50 | 2 | return $this->SUPER::_init(%args); | |||||||||||
| 51 | |||||||||||||
| 52 | } | ||||||||||||
| 53 | |||||||||||||
| 54 | =head2 stringify | ||||||||||||
| 55 | |||||||||||||
| 56 | When stringified, C<autodie::exception::system> objects currently | ||||||||||||
| 57 | use the message generated by L<IPC::System::Simple>. | ||||||||||||
| 58 | |||||||||||||
| 59 | =cut | ||||||||||||
| 60 | |||||||||||||
| 61 | 5 | ▶ | sub stringify { | ||||||||||
|
Subroutine
stringify: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||
| 62 | |||||||||||||
| 63 | 5 | my ($this) = @_; | |||||||||||
| 64 | |||||||||||||
| 65 | 5 | return $this->{$PACKAGE}{message} . $this->add_file_and_line; | |||||||||||
| 66 | |||||||||||||
| 67 | } | ||||||||||||
| 68 | |||||||||||||
| 69 | 3 | 1; | |||||||||||
| 70 | |||||||||||||
| 71 | __END__ | ||||||||||||