line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Articulate::Role::Service; |
2
|
11
|
|
|
11
|
|
5012
|
use strict; |
|
11
|
|
|
|
|
18
|
|
|
11
|
|
|
|
|
355
|
|
3
|
11
|
|
|
11
|
|
45
|
use warnings; |
|
11
|
|
|
|
|
15
|
|
|
11
|
|
|
|
|
246
|
|
4
|
11
|
|
|
11
|
|
40
|
use Moo::Role; |
|
11
|
|
|
|
|
16
|
|
|
11
|
|
|
|
|
64
|
|
5
|
|
|
|
|
|
|
with 'Articulate::Role::Component'; |
6
|
|
|
|
|
|
|
|
7
|
11
|
|
|
11
|
|
8802
|
use Class::Inspector; |
|
11
|
|
|
|
|
25324
|
|
|
11
|
|
|
|
|
2750
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
has verbs => ( |
10
|
|
|
|
|
|
|
is => 'rw', |
11
|
|
|
|
|
|
|
default => sub { |
12
|
|
|
|
|
|
|
my $self = shift; |
13
|
|
|
|
|
|
|
return { |
14
|
|
|
|
|
|
|
map { m/^(handle_(.*))$/; $2 => $1; } |
15
|
|
|
|
|
|
|
grep { /^handle_/ } @{ Class::Inspector->methods( ref $self ) }, |
16
|
|
|
|
|
|
|
}; |
17
|
|
|
|
|
|
|
}, |
18
|
|
|
|
|
|
|
coerce => sub { |
19
|
|
|
|
|
|
|
my $original = shift; |
20
|
|
|
|
|
|
|
if ( ref $original eq ref {} ) { |
21
|
|
|
|
|
|
|
return $original; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
elsif ( ref $original eq ref {} ) { |
24
|
|
|
|
|
|
|
return { map { $_ => "handle_$_"; } @$original }; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
return { $original => "handle_$original" }; |
27
|
|
|
|
|
|
|
}, |
28
|
|
|
|
|
|
|
); |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub process_request { |
31
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
32
|
0
|
|
|
|
|
|
my $request = shift; |
33
|
0
|
|
|
|
|
|
my $verbs = $self->verbs; |
34
|
0
|
|
|
|
|
|
my $verb = $request->verb; |
35
|
0
|
0
|
|
|
|
|
if ( exists $verbs->{$verb} ) { |
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
|
|
|
|
|
|
|
with 'Articulate::Role::Component'; |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
1; |