line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Throwable::SugarFactory::Hashable; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
655
|
use strictures 2; |
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
43
|
|
4
|
1
|
|
|
1
|
|
937
|
use Class::Inspector; |
|
1
|
|
|
|
|
3364
|
|
|
1
|
|
|
|
|
29
|
|
5
|
1
|
|
|
1
|
|
5
|
use Moo::Role; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
7
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.152690'; # VERSION |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
# ABSTRACT: role provides a generic to_hash function for Throwable exceptions |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
# |
12
|
|
|
|
|
|
|
# This file is part of Throwable-SugarFactory |
13
|
|
|
|
|
|
|
# |
14
|
|
|
|
|
|
|
# |
15
|
|
|
|
|
|
|
# Christian Walde has dedicated the work to the Commons by waiving all of his |
16
|
|
|
|
|
|
|
# or her rights to the work worldwide under copyright law and all related or |
17
|
|
|
|
|
|
|
# neighboring legal rights he or she had in the work, to the extent allowable by |
18
|
|
|
|
|
|
|
# law. |
19
|
|
|
|
|
|
|
# |
20
|
|
|
|
|
|
|
# Works under CC0 do not require attribution. When citing the work, you should |
21
|
|
|
|
|
|
|
# not imply endorsement by the author. |
22
|
|
|
|
|
|
|
# |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub to_hash { |
26
|
3
|
|
|
3
|
1
|
11622
|
my ( $self ) = @_; |
27
|
3
|
|
|
|
|
10
|
my @base_methods = qw( error namespace description previous_exception ); |
28
|
3
|
|
|
|
|
7
|
my %skip_methods = map { $_ => 1 } @base_methods, |
|
60
|
|
|
|
|
100
|
|
29
|
|
|
|
|
|
|
qw( BUILDALL BUILDARGS DEMOLISHALL DOES after around before does extends |
30
|
|
|
|
|
|
|
has meta new throw previous_exception to_hash with ); |
31
|
3
|
|
|
|
|
24
|
my $methods = Class::Inspector->methods( ref $self, 'public' ); |
32
|
3
|
|
|
|
|
860
|
my %data = map { $_ => $self->$_ } grep { !$skip_methods{$_} } @{$methods}; |
|
1
|
|
|
|
|
7
|
|
|
58
|
|
|
|
|
92
|
|
|
3
|
|
|
|
|
5
|
|
33
|
3
|
|
|
|
|
7
|
my %out = ( data => \%data, map { $_ => $self->$_ } @base_methods ); |
|
12
|
|
|
|
|
38
|
|
34
|
3
|
|
|
|
|
30
|
return \%out; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
1; |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
__END__ |