Throwable/SugarFactory/Hashable.pm

filter: Statementstmt 100% 23 / 23 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod 100% 1 / 1 totaltotal 100% 28 / 28 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« Throwable/SugarFactory.pm ↑ Summary Throwable/SugarFactory/Utils.pm »
1 package Throwable::SugarFactory::Hashable;
2  
3 2 ▶use strictures 2;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use Class::Inspector;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 2 ▶use Moo::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 2 our $VERSION = '0.213360'; # 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 3 ▶sub to_hash {
Subroutine to_hash: called CC=1 SCAR=0.0
Pod documented
26 3 my ( $self ) = @_;
27 3 my @base_methods = qw( error namespace description previous_exception );
28 3 my %skip_methods = map { $_ => 1 } @base_methods,
29 qw( BUILDALL BUILDARGS DEMOLISHALL DOES after around before does extends
30 has meta new throw previous_exception to_hash with new_with_previous );
31 3 my $methods = Class::Inspector->methods( ref $self, 'public' );
32 3 my %data = map { $_ => $self->$_ } grep { !$skip_methods{$_} } @{$methods};
33 3 my %out = ( data => \%data, map { $_ => $self->$_ } @base_methods );
34 3 return \%out;
35 }
36  
37 2 1;
38  
39 __END__
« Throwable/SugarFactory.pm ↑ Summary Throwable/SugarFactory/Utils.pm »