| 1 | package Articulate::Role::Service; | ||||||||||||||
| 2 | 11 | ▶ | use strict; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 3 | 11 | ▶ | use warnings; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 4 | 11 | ▶ | use Moo::Role; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 5 | 11 | with 'Articulate::Role::Component'; | |||||||||||||
| 6 | |||||||||||||||
| 7 | 11 | ▶ | use Class::Inspector; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 8 | |||||||||||||||
| 9 | has verbs => ( | ||||||||||||||
| 10 | is => 'rw', | ||||||||||||||
| 11 | 32 | ▶ | default => sub { | ||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||
| 12 | 32 | my $self = shift; | |||||||||||||
| 13 | return { | ||||||||||||||
| 14 | 65 | map { m/^(handle_(.*))$/; $2 => $1; } | |||||||||||||
| 15 | 32 | grep { /^handle_/ } @{ Class::Inspector->methods( ref $self ) }, | |||||||||||||
| 16 | }; | ||||||||||||||
| 17 | }, | ||||||||||||||
| 18 | 32 | ▶ | coerce => sub { | ||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=16.0
| |||||||||||||||
| 19 | 32 | my $original = shift; | |||||||||||||
| 20 | 32 | ▶ | if ( ref $original eq ref {} ) { | ||||||||||||
|
Branch: 2 branches
| |||||||||||||||
| 21 | 32 | return $original; | |||||||||||||
| 22 | } | ||||||||||||||
| 23 | elsif ( ref $original eq ref {} ) { | ||||||||||||||
| 24 | 0 | return { map { $_ => "handle_$_"; } @$original }; | |||||||||||||
| 25 | } | ||||||||||||||
| 26 | 0 | return { $original => "handle_$original" }; | |||||||||||||
| 27 | }, | ||||||||||||||
| 28 | 11 | ); | |||||||||||||
| 29 | |||||||||||||||
| 30 | 0 | ▶ | sub process_request { | ||||||||||||
|
Subroutine
process_request: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||
| 31 | 0 | my $self = shift; | |||||||||||||
| 32 | 0 | my $request = shift; | |||||||||||||
| 33 | 0 | my $verbs = $self->verbs; | |||||||||||||
| 34 | 0 | my $verb = $request->verb; | |||||||||||||
| 35 | 0 | ▶ | if ( exists $verbs->{$verb} ) { | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 36 | 0 | my $method = $verbs->{$verb}; | |||||||||||||
| 37 | 0 | $request->app( $self->app ); | |||||||||||||
| 38 | 0 | return $self->$method( $request, @_ ); | |||||||||||||
| 39 | } | ||||||||||||||
| 40 | 0 | return undef; # whatever else the user wants, we can't provide it | |||||||||||||
| 41 | } | ||||||||||||||
| 42 | |||||||||||||||
| 43 | 11 | with 'Articulate::Role::Component'; | |||||||||||||
| 44 | |||||||||||||||
| 45 | 11 | 1; | |||||||||||||