Lim/RPC/Transport.pm

filter: Statementstmt 85.4% 41 / 48 Branchbran 50.0% 4 / 8 Conditioncond 33.3% 3 / 9 MC/DCmcdc 0.0% 0 / 6 Subroutinesub 56.2% 9 / 16 Podpod 100% 10 / 10 totaltotal 69.0% 67 / 97 SCAR 23.5
CC
9
Cov
74%
new
5.8
add_protocol
4.6
DESTROY
2.0
CRAP 10.4
« Lim/Component/Server.pm ↑ Summary Lim/RPC/Callback.pm »
1 package Lim::RPC::Transport;
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 sub new {
36 4 ▶ my $this = shift;
Subroutine new: called CC=5 SCAR=17.6
Pod documented
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,
41 __protocols => []
42 };
43 4 bless $self, $class;
44  
45 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
46 0 confess __PACKAGE__, ': No server specified or invalid';
47 }
48 4 $self->{__server} = $args{server};
49 4 weaken($self->{__server});
50
51 4 $self->Init(@_);
52  
53 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
54 4 $self;
55 }
56  
57 sub DESTROY {
58 4 ▶ my ($self) = @_;
Subroutine DESTROY: called CC=2 SCAR=7.0
59 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
60
61 4 $self->Destroy;
62 4 delete $self->{__protocols};
63 4 delete $self->{__server};
64 }
65  
66 =head2 Init
67  
68 =cut
69  
70 ▶sub Init {
Subroutine Init: not called CC=1 SCAR=0.0
Pod documented
71 }
72  
73 =head2 Destroy
74  
75 =cut
76  
77 ▶sub Destroy {
Subroutine Destroy: not called CC=1 SCAR=0.0
Pod documented
78 }
79  
80 =head2 name
81  
82 =cut
83  
84 sub name {
85 0 ▶ confess 'function name not overloaded';
Subroutine name: not called CC=1 SCAR=6.9
Pod documented
86 }
87  
88 =head2 uri
89  
90 =cut
91  
92 sub uri {
93 0 ▶ confess 'function uri not overloaded';
Subroutine uri: not called CC=1 SCAR=6.9
Pod documented
94 }
95  
96 =head2 add_protocol
97  
98 =cut
99  
100 sub add_protocol {
101 4 ▶ my $self = shift;
Subroutine add_protocol: called CC=4 SCAR=15.2
Pod documented
102
103 4 foreach (@_) {
104 4 ▶ unless (blessed($_) and $_->isa('Lim::RPC::Protocol')) {
Branch: 1 branch
BranchTrueFalseTotal
unless (builtin::blessed($_) and $_->isa("Lim::RPC::Protocol")) 0 4 4
Condition33%1/3
builtin::blessed($_) and $_->isa("Lim::RPC::Protocol")
!ll&&!rl&&r
004
MC/DC0%0/2
builtin::blessed($_) and $_->isa("Lim::RPC::Protocol")
builtin::blessed($_) $_->isa("Lim::RPC::Protocol")
Truth table33%1/3
A and B
A= builtin::blessed($_)B= $_->isa("Lim::RPC::Protocol")
ABresult
0X0
100
111
105 0 confess 'Argument is not a Lim::RPC::Protocol';
106 }
107 }
108 4 push(@{$self->{__protocols}}, @_);
109
110 4 $self;
111 }
112  
113 =head2 protocols
114  
115 =cut
116  
117 sub protocols {
118 4 ▶ @{$_[0]->{__protocols}};
Subroutine protocols: called CC=1 SCAR=0.0
Pod documented
119 }
120  
121 =head2 server
122  
123 =cut
124  
125 sub server {
126 0 ▶ $_[0]->{__server};
Subroutine server: not called CC=1 SCAR=6.9
Pod documented
127 }
128  
129 =head2 host
130  
131 =cut
132  
133 sub host {
134 0 ▶ confess 'function host not overloaded';
Subroutine host: not called CC=1 SCAR=6.9
Pod documented
135 }
136  
137 =head2 port
138  
139 =cut
140  
141 sub port {
142 0 ▶ confess 'function port not overloaded';
Subroutine port: not called CC=1 SCAR=6.9
Pod documented
143 }
144  
145 =head1 AUTHOR
146  
147 Jerry Lundström, C<< <lundstrom.jerry at gmail.com> >>
148  
149 =head1 BUGS
150  
151 Please report any bugs or feature requests to L<https://github.com/jelu/lim/issues>.
152  
153 =head1 SUPPORT
154  
155 You can find documentation for this module with the perldoc command.
156  
157 perldoc Lim
158  
159 You can also look for information at:
160  
161 =over 4
162  
163 =item * Lim issue tracker (report bugs here)
164  
165 L<https://github.com/jelu/lim/issues>
166  
167 =back
168  
169 =head1 ACKNOWLEDGEMENTS
170  
171 =head1 LICENSE AND COPYRIGHT
172  
173 Copyright 2012-2013 Jerry Lundström.
174  
175 This program is free software; you can redistribute it and/or modify it
176 under the terms of either: the GNU General Public License as published
177 by the Free Software Foundation; or the Artistic License.
178  
179 See http://dev.perl.org/licenses/ for more information.
180  
181  
182 =cut
183  
184 5 1; # End of Lim::RPC::Transport
« Lim/Component/Server.pm ↑ Summary Lim/RPC/Callback.pm »