| 1 | 1 | ▶ | use 5.008; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 2 | 1 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 3 | 1 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | |||
| 5 | package Class::Scaffold::YAML::Active::ExceptionContainer; | ||
| 6 | 1 | ▶ | BEGIN { |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | 1 | $Class::Scaffold::YAML::Active::ExceptionContainer::VERSION = '1.102280'; | |
| 8 | } | ||
| 9 | # ABSTRACT: Plugin that constructs an exception container | ||
| 10 | 1 | ▶ | use YAML::Active qw/assert_arrayref array_activate/; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 11 | 1 | ▶ | use parent 'Class::Scaffold::YAML::Active'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 12 | |||
| 13 | 0 | ▶ | sub yaml_activate { |
|
Subroutine
yaml_activate: not called CC=2 SCAR=17.9
Pod
documented
| |||
| 14 | 0 | my ($self, $phase) = @_; | |
| 15 | 0 | assert_arrayref($self); | |
| 16 | 0 | my $exceptions = array_activate($self, $phase); | |
| 17 | |||
| 18 | # Expect a list of hashrefs; each hash element is an exception with a | ||
| 19 | # 'ref' key giving the exception class, and the rest being treated as args | ||
| 20 | # to give to the exception when it is being recorded. Example: | ||
| 21 | # | ||
| 22 | # exception_container: !perl/Class::Scaffold::YAML::Active::ExceptionContainer | ||
| 23 | # - ref: Class::Scaffold::Exception::Policy::Blah | ||
| 24 | # property1: value1 | ||
| 25 | # property2: value2 | ||
| 26 | 0 | my $container = $self->delegate->make_obj('exception_container'); | |
| 27 | 0 | for my $exception (@$exceptions) { | |
| 28 | 0 | my $class = $exception->{ref}; | |
| 29 | 0 | delete $exception->{ref}; | |
| 30 | 0 | $container->record($class, %$exception); | |
| 31 | } | ||
| 32 | 0 | $container; | |
| 33 | } | ||
| 34 | 1 | 1; | |
| 35 | |||
| 36 | |||
| 37 | __END__ | ||