example/lib/QxExample/JsonRpcService.pm

filter: Statementstmt 69.2% 18 / 26 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 62.5% 5 / 8 Podpod 100% 3 / 3 totaltotal 66.6% 26 / 39 CC 2 SCAR 8.5
CC
2
Cov
64%
echo
6.0
allow_rpc_access
2.0
stringify
2.0
CRAP 2.3
« lib/Mojolicious/Plugin/QooxdooJsonrpc.pm ↑ Summary example/lib/QxExample.pm »
1 package QxExample::JsonRpcService;
2 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use Mojo::Base -base;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 =head1 NAME
6  
7 JsonRpcService - RPC services for Qooxdoo
8  
9 =head1 SYNOPSIS
10  
11 This module gets instanciated by L<ep::MojoApp> and provides backend functionality for your qooxdoo app
12  
13 =head1 DESCRIPTION
14  
15 All methods on this class can get called remotely as long as their name does not start with an underscore.
16  
17 =head2 new()
18  
19 Create a service object.
20  
21 =cut
22  
23 1 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
Pod documented
24 1 my $self = shift->SUPER::new(@_);
25 # do some other interesting initialization work
26 1 return $self;
27 }
28  
29 =head2 allow_rpc_access
30  
31 check it this method may be called
32  
33 =cut
34  
35 1 our %allow_access = (
36 echo => 1
37 );
38  
39 0 ▶sub allow_rpc_access {
Subroutine allow_rpc_access: not called CC=1 SCAR=6.9
Pod documented
40 0 my $self = shift;
41 0 my $method = shift;
42 0 return $allow_access{$method};
43 }
44  
45 =head2 echo(var)
46  
47 return the string we input
48  
49 =cut
50  
51 0 ▶sub echo {
Subroutine echo: not called CC=2 SCAR=17.9
Pod documented
52 0 my $self = shift;
53 0 ▶ my $arg = shift or die QxExample::Exception->new(code=>123,message=>"Argument Required!");
Branch: 1 branch
BranchTrueFalseTotal
my $arg = shift() or die "QxExample::Exception"->new("code", 123, "message", "Argument Required!") 0 0 0
54 0 return $arg;
55 }
56  
57 package QxExample::Exception;
58 1 ▶use Mojo::Base -base;
Subroutine BEGIN: called CC=1 SCAR=0.0
59 1 has 'code';
60 1 has 'message';
61 1 ▶use overload ('""' => 'stringify');
Subroutine BEGIN: called CC=1 SCAR=0.0
62 0 ▶sub stringify {
Subroutine stringify: not called CC=1 SCAR=6.9
63 0 my $self = shift;
64 0 return "ERROR ".$self->code.": ".$self->message;
65 }
66  
67 1 1;
68 __END__
« lib/Mojolicious/Plugin/QooxdooJsonrpc.pm ↑ Summary example/lib/QxExample.pm »