| 1 | 1 | ▶ | use 5.008; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 2 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | 1 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | |||||||||||
| 5 | package Data::Conveyor::Service::Result::Container; | ||||||||||
| 6 | 1 | ▶ | BEGIN { | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 1 | $Data::Conveyor::Service::Result::Container::VERSION = '1.103130'; | |||||||||
| 8 | } | ||||||||||
| 9 | # ABSTRACT: Stage-based conveyor-belt-like ticket handling system | ||||||||||
| 10 | |||||||||||
| 11 | # | ||||||||||
| 12 | # Contains a list of other result objects, which can include other | ||||||||||
| 13 | # containers, since they derive from the same subclass as "normal" service | ||||||||||
| 14 | # result objects such as scalars and tables. | ||||||||||
| 15 | 1 | ▶ | use YAML; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 16 | 1 | ▶ | use parent 'Data::Conveyor::Service::Result'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 17 | |||||||||||
| 18 | # don't subclass Data::Container, since we have a slightly different API - we | ||||||||||
| 19 | # use 'result' instead of 'items', for example. | ||||||||||
| 20 | 1 | __PACKAGE__->mk_array_accessors(qw(result)); | |||||||||
| 21 | |||||||||||
| 22 | # concatenate the stringifications of the result list | ||||||||||
| 23 | 0 | ▶ | sub result_as_string { | ||||||||
|
Subroutine
result_as_string: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 24 | 0 | my $self = shift; | |||||||||
| 25 | 0 | join "\n" => map { "$_" } $self->result; | |||||||||
| 26 | } | ||||||||||
| 27 | |||||||||||
| 28 | # Here exception() is a method, not an attribute. You can't set an exception | ||||||||||
| 29 | # on a container directly; rather, if elements of the result list have | ||||||||||
| 30 | # exceptions, they will be returned in an exception container. If there are no | ||||||||||
| 31 | # exceptions in the results, undef will be returned. | ||||||||||
| 32 | 0 | ▶ | sub exception { | ||||||||
|
Subroutine
exception: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||
| 33 | 0 | my $self = shift; | |||||||||
| 34 | 0 | my @exception = grep { defined } map { $_->exception } $self->result; | |||||||||
| 35 | 0 | ▶ | return unless @exception; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 36 | 0 | my $container = $self->delegate->make_obj('exception_container'); | |||||||||
| 37 | 0 | $container->items(@exception); | |||||||||
| 38 | 0 | $container; | |||||||||
| 39 | } | ||||||||||
| 40 | 1 | 1; | |||||||||
| 41 | |||||||||||
| 42 | |||||||||||
| 43 | __END__ | ||||||||||