line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mojolicious::Plugin::JsonRpcDispatcher; |
2
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
1311
|
use Mojo::Base 'Mojolicious::Plugin'; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
14
|
|
4
|
3
|
|
|
3
|
|
1716
|
use MojoX::JSON::RPC::Dispatcher; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
29
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
sub register { |
7
|
3
|
|
|
3
|
1
|
85
|
my ( $self, $app, $conf ) = @_; |
8
|
|
|
|
|
|
|
|
9
|
3
|
|
|
|
|
9
|
my $r = $app->routes; |
10
|
3
|
50
|
33
|
|
|
24
|
if ( exists $conf->{services} && ref $conf->{services} eq 'HASH' ) { |
11
|
|
|
|
|
|
|
SVC: |
12
|
3
|
|
|
|
|
5
|
while ( my ( $path, $svc ) = each %{ $conf->{services} } ) { |
|
7
|
|
|
|
|
849
|
|
13
|
|
|
|
|
|
|
$r->route($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
|
|
|
|
20
|
: () |
20
|
|
|
|
|
|
|
); |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
else { |
24
|
0
|
|
|
|
|
0
|
Carp::confess 'No services found!'; |
25
|
|
|
|
|
|
|
} |
26
|
3
|
|
|
|
|
9
|
return; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
1; |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
__END__ |