line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Throwable::SysError; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
28378
|
use namespace::autoclean; |
|
2
|
|
|
|
|
83370
|
|
|
2
|
|
|
|
|
14
|
|
4
|
2
|
|
|
2
|
|
1114
|
use Errno qw(); |
|
2
|
|
|
|
|
1516
|
|
|
2
|
|
|
|
|
38
|
|
5
|
2
|
|
|
2
|
|
3960
|
use Moo; |
|
2
|
|
|
|
|
36704
|
|
|
2
|
|
|
|
|
13
|
|
6
|
2
|
|
|
2
|
|
11262
|
use MooX::Types::MooseLike::Base qw( Int Str ); |
|
2
|
|
|
|
|
24469
|
|
|
2
|
|
|
|
|
242
|
|
7
|
2
|
|
|
2
|
|
24
|
use Scalar::Util qw(); |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
906
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
extends qw( Throwable::Error ); |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $VERSION = '0.00'; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
has op => ( is => 'ro', isa => Str, required => 1 ); |
15
|
|
|
|
|
|
|
has errno => ( is => 'ro', isa => Int, required => 1 ); |
16
|
|
|
|
|
|
|
has errstr => ( is => 'ro', isa => Str, required => 1 ); |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
around BUILDARGS => sub { |
20
|
|
|
|
|
|
|
my ( $orig, $class ) = ( shift, shift ); |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
my $args = $class->$orig( @_ ); |
23
|
|
|
|
|
|
|
my $_errno = defined $args->{_errno} |
24
|
|
|
|
|
|
|
? do { local $! = $args->{_errno}; $! } |
25
|
|
|
|
|
|
|
: $! |
26
|
|
|
|
|
|
|
; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
@$args{qw( errno errstr )} |
29
|
|
|
|
|
|
|
= ( 0 + $_errno, ''. $_errno ); |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
$args |
32
|
|
|
|
|
|
|
}; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
around throw => sub { |
35
|
|
|
|
|
|
|
my ( $orig, $invocant ) = ( shift, shift ); |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
# save $! as soon as possible |
38
|
|
|
|
|
|
|
my $_errno = $!; |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
# pass-through on re-throw |
41
|
|
|
|
|
|
|
return $invocant->$orig( @_ ) |
42
|
|
|
|
|
|
|
if Scalar::Util::blessed( $invocant ); |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
# fix up @_ to include _errno |
45
|
|
|
|
|
|
|
if( @_ == 1 ) { |
46
|
|
|
|
|
|
|
# inject _errno if we have a single hash argument. |
47
|
|
|
|
|
|
|
# otherwise we don't know what to do. |
48
|
|
|
|
|
|
|
$_[0]->{_errno} = $_errno |
49
|
|
|
|
|
|
|
if ref $_[0] eq 'HASH' && ! defined $_[0]->{_errno}; |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
else { |
52
|
|
|
|
|
|
|
# inject _errno at the front of the list to allow |
53
|
|
|
|
|
|
|
# overriding when in new() |
54
|
|
|
|
|
|
|
unshift @_, _errno => $_errno; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
$invocant->$orig( @_ ) |
58
|
|
|
|
|
|
|
}; |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub is { |
61
|
2
|
|
|
2
|
1
|
4494
|
my ( $self, $errname ) = @_; |
62
|
|
|
|
|
|
|
|
63
|
2
|
|
|
|
|
22
|
local $! = $self->errno; |
64
|
2
|
|
|
|
|
16
|
$!{$errname} |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
1 |
69
|
|
|
|
|
|
|
__END__ |