Lim/RPC/Protocol.pm

filter: Statementstmt 84.4% 38 / 45 Branchbran 50.0% 4 / 8 Conditioncond 33.3% 2 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 52.9% 9 / 17 Podpod 100% 11 / 11 totaltotal 70.3% 64 / 91 CC 7 SCAR 10.7
CC
7
Cov
75%
new
7.0
DESTROY
2.0
name
2.0
CRAP 2.9
« Lim/RPC/Transport.pm ↑ Summary Lim/Agent.pm »
1 package Lim::RPC::Protocol;
2  
3 5 ▶use common::sense;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 5 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 5 ▶use Scalar::Util qw(blessed weaken);
Subroutine BEGIN: called CC=1 SCAR=0.0
7 5 ▶use Log::Log4perl ();
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 5 ▶use Lim ();
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 =encoding utf8
12  
13 =head1 NAME
14  
15 ...
16  
17 =head1 VERSION
18  
19 See L<Lim> for version.
20  
21 =cut
22  
23 5 our $VERSION = $Lim::VERSION;
24  
25 =head1 SYNOPSIS
26  
27 ...
28  
29 =head1 SUBROUTINES/METHODS
30  
31 =head2 new
32  
33 =cut
34  
35 4 ▶sub new {
Subroutine new: called CC=6 SCAR=19.5
Pod documented
36 4 my $this = shift;
37 4 ▶ my $class = ref($this) || $this;
Condition33%1/3
ref $this || $this
l!l&&r!l&&!r
040
MC/DC0%0/2
ref $this || $this
ref $this $this
Truth table33%1/3
A || B
A= ref $thisB= $this
ABresult
1X1
011
000
38 4 my %args = ( @_ );
39 4 my $self = {
40 logger => Log::Log4perl->get_logger($class),
41 server => undef
42 };
43 4 bless $self, $class;
44 4 weaken($self->{logger});
45  
46 4 ▶ if (exists $args{server}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $args{"server"}) 4 0 4
47 4 ▶ unless (blessed($args{server}) and $args{server}->isa('Lim::RPC::Server')) {
Branch: 1 branch
BranchTrueFalseTotal
unless (builtin::blessed($args{"server"}) and $args{"server"}->isa("Lim::RPC::Server")) 0 4 4
Condition33%1/3
builtin::blessed($args{"server"}) and $args{"server"}->isa("Lim::RPC::Server")
!ll&&!rl&&r
004
MC/DC0%0/2
builtin::blessed($args{"server"}) and $args{"server"}->isa("Lim::RPC::Server")
builtin::blessed($args{"server"}) $args{"server"}->isa("Lim::RPC::Server")
Truth table33%1/3
A and B
A= builtin::blessed($args{"server"})B= $args{"server"}->isa("Lim::RPC::Server")
ABresult
0X0
100
111
48 0 confess __PACKAGE__, ': No server specified or invalid';
49 }
50 4 $self->{__server} = $args{server};
51 4 weaken($self->{__server});
52 }
53  
54 4 $self->Init(@_);
55  
56 4 ▶ Lim::OBJ_DEBUG and $self->{logger}->debug('new ', __PACKAGE__, ' ', $self);
Branch: 1 branch
BranchTrueFalseTotal
Lim::OBJ_DEBUG() and $self->{"logger"}->debug("new ", __PACKAGE__, " ", $self) 4 0 4
57 4 $self;
58 }
59  
60 4 ▶sub DESTROY {
Subroutine DESTROY: called CC=2 SCAR=7.0
61 4 my ($self) = @_;
62 4 ▶ Lim::OBJ_DEBUG and $self->{logger}->debug('destroy ', __PACKAGE__, ' ', $self);
Branch: 1 branch
BranchTrueFalseTotal
Lim::OBJ_DEBUG() and $self->{"logger"}->debug("destroy ", __PACKAGE__, " ", $self) 4 0 4
63  
64 4 $self->Destroy;
65 4 delete $self->{__server};
66 }
67  
68 =head2 Init
69  
70 =cut
71  
72 0 ▶sub Init {
Subroutine Init: not called CC=1 SCAR=0.0
Pod documented
73 }
74  
75 =head2 Destroy
76  
77 =cut
78  
79 0 ▶sub Destroy {
Subroutine Destroy: not called CC=1 SCAR=0.0
Pod documented
80 }
81  
82 =head2 name
83  
84 =cut
85  
86 0 ▶sub name {
Subroutine name: not called CC=1 SCAR=6.9
Pod documented
87 0 confess 'function name not overloaded';
88 }
89  
90 =head2 serve
91  
92 =cut
93  
94 0 ▶sub serve {
Subroutine serve: not called CC=1 SCAR=6.9
Pod documented
95 0 confess 'function serve not overloaded';
96 }
97  
98 =head2 handle
99  
100 =cut
101  
102 0 ▶sub handle {
Subroutine handle: not called CC=1 SCAR=6.9
Pod documented
103 0 confess 'function handle not overloaded';
104 }
105  
106 =head2 timeout
107  
108 =cut
109  
110 0 ▶sub timeout {
Subroutine timeout: not called CC=1 SCAR=6.9
Pod documented
111 0 confess 'function timeout not overloaded';
112 }
113  
114 =head2 server
115  
116 =cut
117  
118 6 ▶sub server {
Subroutine server: called CC=1 SCAR=0.0
Pod documented
119 6 $_[0]->{__server};
120 }
121  
122 =head2 precall
123  
124 =cut
125  
126 2 ▶sub precall {
Subroutine precall: called CC=1 SCAR=0.0
Pod documented
127 2 shift; # $self
128 2 shift; # $call
129 2 return @_;
130 }
131  
132 =head2 request
133  
134 =cut
135  
136 0 ▶sub request {
Subroutine request: not called CC=1 SCAR=6.9
Pod documented
137 0 confess 'function request not overloaded';
138 }
139  
140 =head2 response
141  
142 =cut
143  
144 0 ▶sub response {
Subroutine response: not called CC=1 SCAR=6.9
Pod documented
145 0 confess 'function response not overloaded';
146 }
147  
148 =head1 AUTHOR
149  
150 Jerry Lundström, C<< <lundstrom.jerry at gmail.com> >>
151  
152 =head1 BUGS
153  
154 Please report any bugs or feature requests to L<https://github.com/jelu/lim/issues>.
155  
156 =head1 SUPPORT
157  
158 You can find documentation for this module with the perldoc command.
159  
160 perldoc Lim
161  
162 You can also look for information at:
163  
164 =over 4
165  
166 =item * Lim issue tracker (report bugs here)
167  
168 L<https://github.com/jelu/lim/issues>
169  
170 =back
171  
172 =head1 ACKNOWLEDGEMENTS
173  
174 =head1 LICENSE AND COPYRIGHT
175  
176 Copyright 2012-2013 Jerry Lundström.
177  
178 This program is free software; you can redistribute it and/or modify it
179 under the terms of either: the GNU General Public License as published
180 by the Free Software Foundation; or the Artistic License.
181  
182 See http://dev.perl.org/licenses/ for more information.
183  
184  
185 =cut
186  
187 5 1; # End of Lim::RPC::Protocol
« Lim/RPC/Transport.pm ↑ Summary Lim/Agent.pm »