line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mojolicious::Plugin::JsonRpcDispatcher; |
2
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
2113
|
use Mojo::Base 'Mojolicious::Plugin'; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
18
|
|
4
|
3
|
|
|
3
|
|
1648
|
use MojoX::JSON::RPC::Dispatcher; |
|
3
|
|
|
|
|
10
|
|
|
3
|
|
|
|
|
45
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
sub register { |
7
|
3
|
|
|
3
|
1
|
223
|
my ( $self, $app, $conf ) = @_; |
8
|
|
|
|
|
|
|
|
9
|
3
|
|
|
|
|
21
|
my $r = $app->routes; |
10
|
3
|
50
|
33
|
|
|
35
|
if ( exists $conf->{services} && ref $conf->{services} eq 'HASH' ) { |
11
|
|
|
|
|
|
|
SVC: |
12
|
3
|
|
|
|
|
6
|
while ( my ( $path, $svc ) = each %{ $conf->{services} } ) { |
|
7
|
|
|
|
|
1711
|
|
13
|
|
|
|
|
|
|
$r->any($path)->to( |
14
|
|
|
|
|
|
|
'Dispatcher#call', |
15
|
|
|
|
|
|
|
service => $svc, |
16
|
|
|
|
|
|
|
namespace => 'MojoX::JSON::RPC', |
17
|
|
|
|
|
|
|
exists $conf->{exception_handler} |
18
|
|
|
|
|
|
|
? ( exception_handler => $conf->{exception_handler} ) |
19
|
4
|
100
|
|
|
|
53
|
: () |
20
|
|
|
|
|
|
|
); |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
else { |
24
|
0
|
|
|
|
|
0
|
Carp::confess 'No services found!'; |
25
|
|
|
|
|
|
|
} |
26
|
3
|
|
|
|
|
11
|
return; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
1; |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
__END__ |