Scaffold/YAML/Marshall/ExceptionContainer.pm

filter: Statementstmt 66.6% 16 / 24 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 85.7% 6 / 7 Podpod 100% 1 / 1 totaltotal 71.8% 23 / 32 CC 2 SCAR 8.1
CC
2
Cov
67%
yaml_load
6.0
BEGIN
1.0
BEGIN
1.0
CRAP 2.2
« Scaffold/YAML/Active/ExceptionContainer.pm ↑ Summary Scaffold/YAML/Active/Environment.pm »
1 2 ▶use 5.008;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 package Class::Scaffold::YAML::Marshall::ExceptionContainer;
6 2 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
7 2 $Class::Scaffold::YAML::Marshall::ExceptionContainer::VERSION = '1.102280';
8 }
9 # ABSTRACT: Marshalling plugin that constructs an exception container
10 2 ▶use YAML::Marshall 'exception/container';
Subroutine BEGIN: called CC=1 SCAR=0.0
11 2 ▶use parent 'Class::Scaffold::YAML::Marshall';
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 0 ▶sub yaml_load {
Subroutine yaml_load: not called CC=2 SCAR=17.9
Pod documented
14 0 my $self = shift;
15 0 my $node = $self->SUPER::yaml_load(@_);
16  
17 # Expect a list of hashrefs; each hash element is an exception with a
18 # 'ref' key giving the exception class, and the rest being treated as args
19 # to give to the exception when it is being recorded. Example:
20 #
21 # exception_container: !perl/Class::Scaffold::YAML::Active::ExceptionContainer
22 # - ref: Class::Scaffold::Exception::Policy::Blah
23 # property1: value1
24 # property2: value2
25 0 my $container = $self->delegate->make_obj('exception_container');
26 0 for my $exception (@$node) {
27  
28 # Copy because we delete (so as to not mess up YAML references)
29 0 my %args = %$exception;
30 0 my $class = delete $args{ref};
31 0 $container->record($class, %args);
32 }
33 0 $container;
34 }
35 2 1;
36  
37  
38 __END__
« Scaffold/YAML/Active/ExceptionContainer.pm ↑ Summary Scaffold/YAML/Active/Environment.pm »