| 1 | package Mojolicious::Plugin::JsonRpcDispatcher; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 3 | ▶ | use Mojo::Base 'Mojolicious::Plugin'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 3 | ▶ | use MojoX::JSON::RPC::Dispatcher; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | 3 | ▶ | sub register { | ||||||||||||||||||||||||||
|
Subroutine
register: called CC=5 SCAR=16.7
Pod
documented
| |||||||||||||||||||||||||||||
| 7 | 3 | my ( $self, $app, $conf ) = @_; | |||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | 3 | my $r = $app->routes; | |||||||||||||||||||||||||||
| 10 | 3 | ▶ | if ( exists $conf->{services} && ref $conf->{services} eq 'HASH' ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
exists $conf->{"services"} and ref $conf->{"services"} eq "HASH"
MC/DC0%0/2
exists $conf->{"services"} and ref $conf->{"services"} eq "HASH"
exists $conf->{"services"}
ref $conf->{"services"} eq "HASH"
Truth table33%1/3
A and B
A= exists $conf->{"services"}B= ref $conf->{"services"} eq "HASH"
| |||||||||||||||||||||||||||||
| 11 | SVC: | ||||||||||||||||||||||||||||
| 12 | 3 | ▶ | while ( my ( $path, $svc ) = each %{ $conf->{services} } ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 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 | ▶ | : () | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 20 | ); | ||||||||||||||||||||||||||||
| 21 | } | ||||||||||||||||||||||||||||
| 22 | } | ||||||||||||||||||||||||||||
| 23 | else { | ||||||||||||||||||||||||||||
| 24 | 0 | Carp::confess 'No services found!'; | |||||||||||||||||||||||||||
| 25 | } | ||||||||||||||||||||||||||||
| 26 | 3 | return; | |||||||||||||||||||||||||||
| 27 | } | ||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||
| 29 | 3 | 1; | |||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | __END__ | ||||||||||||||||||||||||||||