| 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__ | ||