| 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::Util; | ||||||||||
| 6 | 1 | ▶ | BEGIN { | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 1 | $Data::Conveyor::Service::Util::VERSION = '1.103130'; | |||||||||
| 8 | } | ||||||||||
| 9 | # ABSTRACT: Stage-based conveyor-belt-like ticket handling system | ||||||||||
| 10 | |||||||||||
| 11 | # | ||||||||||
| 12 | # Mixin class for making service interface method implementations easier. It | ||||||||||
| 13 | # helps in interacting with the storage object. However, these helper methods | ||||||||||
| 14 | # make assumptions about the structure of the underlying storage calls. If | ||||||||||
| 15 | # these assumptions apply to your storage, you may find these methods useful. | ||||||||||
| 16 | 1 | ▶ | use Error ':try'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 17 | 1 | ▶ | use Error::Hierarchy::Util 'assert_nonempty_arrayref'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 18 | |||||||||||
| 19 | 0 | ▶ | sub svc_check_arguments { | ||||||||
|
Subroutine
svc_check_arguments: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||
| 20 | 0 | my ($self, $passed_args, $supported_list) = @_; | |||||||||
| 21 | 0 | assert_nonempty_arrayref $supported_list, | |||||||||
| 22 | 'list of supported parameters is empty'; | ||||||||||
| 23 | 0 | my $container = $self->delegate->make_obj('exception_container'); | |||||||||
| 24 | 0 | my %supported = map { $_ => 1 } @$supported_list; | |||||||||
| 25 | 0 | my $exception; | |||||||||
| 26 | 0 | for my $arg (keys %$passed_args) { | |||||||||
| 27 | 0 | ▶ | next if exists $supported{$arg}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 28 | 0 | $container->record( | |||||||||
| 29 | 'Error::Hierarchy::Internal::CustomMessage', | ||||||||||
| 30 | custom_message => sprintf( | ||||||||||
| 31 | "Unsupported parameter '%s'. (Supported: %s)" => $arg, | ||||||||||
| 32 | join ', ' => @$supported_list | ||||||||||
| 33 | ) | ||||||||||
| 34 | ); | ||||||||||
| 35 | 0 | $exception++; | |||||||||
| 36 | } | ||||||||||
| 37 | 0 | ▶ | $container->throw if $exception; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 38 | } | ||||||||||
| 39 | |||||||||||
| 40 | # FIXME | ||||||||||
| 41 | # | ||||||||||
| 42 | # This method makes assumptions on the structure of underlying storage calls, | ||||||||||
| 43 | # and is used by Registry::NICAT::Channel::Mail::Output and | ||||||||||
| 44 | # Registry::NICAT::Confirm. | ||||||||||
| 45 | # | ||||||||||
| 46 | # Is there a better place for it? | ||||||||||
| 47 | 0 | ▶ | sub svc_result_for_storage_call { | ||||||||
|
Subroutine
svc_result_for_storage_call: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||
| 48 | 0 | my ($self, $storage_call, $supported_args, %args) = @_; | |||||||||
| 49 | 0 | assert_nonempty_arrayref $supported_args, | |||||||||
| 50 | 'list of supported parameters is empty'; | ||||||||||
| 51 | 0 | ▶ | $storage_call | ||||||||
|
Branch: 1 branch
| |||||||||||
| 52 | || throw Error::Hierarchy::Internal::CustomMessage( | ||||||||||
| 53 | custom_message => sprintf "bad call parameter '$storage_call'"); | ||||||||||
| 54 | 0 | $self->svc_check_arguments(\%args, $supported_args); | |||||||||
| 55 | $self->delegate->make_obj('service_result_scalar', | ||||||||||
| 56 | 0 | result => scalar $self->storage->$storage_call(@args{@$supported_args}) | |||||||||
| 57 | ); | ||||||||||
| 58 | } | ||||||||||
| 59 | 1 | 1; | |||||||||
| 60 | |||||||||||
| 61 | |||||||||||
| 62 | __END__ | ||||||||||