Lim/Component/Client.pm

filter: Statementstmt 38.6% 17 / 44 Branchbran 0.0% 0 / 16 Conditioncond 0.0% 0 / 9 MC/DCmcdc 0.0% 0 / 6 Subroutinesub 45.4% 5 / 11 Podpod 100% 3 / 3 totaltotal 28.0% 25 / 89 CC 12 SCAR 27.1
CC
12
Cov
25%
new
30.0
_addCall
20.0
_deleteCall
20.0
CRAP 15.0
« Lim/RPC/Transport/HTTP.pm ↑ Summary Lim/Component/CLI.pm »
1 package Lim::Component::Client;
2  
3 1 ▶use common::sense;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 ▶use Log::Log4perl ();
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use Scalar::Util qw(blessed weaken);
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 1 ▶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 1 our $VERSION = $Lim::VERSION;
24  
25 =head1 SYNOPSIS
26  
27 ...
28  
29 =head1 SUBROUTINES/METHODS
30  
31 =head2 new
32  
33 =cut
34  
35 0 ▶sub new {
Subroutine new: not called CC=5 SCAR=34.0
Pod documented
36 0 my $this = shift;
37 0 ▶ my $class = ref($this) || $this;
Condition0%0/3
ref $this || $this
l!l&&r!l&&!r
000
MC/DC0%0/2
ref $this || $this
ref $this $this
Truth table0%0/3
A || B
A= ref $thisB= $this
ABresult
1X1
011
000
38 0 my $self = {
39 logger => Log::Log4perl->get_logger($class),
40 call => {}
41 };
42 0 bless $self, $class;
43 0 weaken($self->{logger});
44  
45 0 eval {
46 0 $self->Init(@_);
47 };
48 0 ▶ if ($@) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 0 0
49 0 ▶ Lim::WARN and $self->{logger}->warn('Unable to initialize module '.$class.': '.$@);
Branch: 1 branch
BranchTrueFalseTotal
Lim::WARN() and $self->{"logger"}->warn('Unable to initialize module ' . $class . ': ' . $@) 0 0 0
50 0 return;
51 }
52  
53 0 ▶ Lim::OBJ_DEBUG and $self->{logger}->debug('new ', __PACKAGE__, ' ', $self);
Branch: 1 branch
BranchTrueFalseTotal
Lim::OBJ_DEBUG() and $self->{"logger"}->debug("new ", __PACKAGE__, " ", $self) 0 0 0
54 0 $self;
55 }
56  
57 0 ▶sub DESTROY {
Subroutine DESTROY: not called CC=2 SCAR=17.9
58 0 my ($self) = @_;
59 0 ▶ Lim::OBJ_DEBUG and $self->{logger}->debug('destroy ', __PACKAGE__, ' ', $self);
Branch: 1 branch
BranchTrueFalseTotal
Lim::OBJ_DEBUG() and $self->{"logger"}->debug("destroy ", __PACKAGE__, " ", $self) 0 0 0
60  
61 0 $self->Destroy;
62 }
63  
64 =head2 Init
65  
66 =cut
67  
68 0 ▶sub Init {
Subroutine Init: not called CC=1 SCAR=0.0
Pod documented
69 }
70  
71 =head2 Destroy
72  
73 =cut
74  
75 0 ▶sub Destroy {
Subroutine Destroy: not called CC=1 SCAR=0.0
Pod documented
76 }
77  
78 =head2 _addCall
79  
80 =cut
81  
82 0 ▶sub _addCall {
Subroutine _addCall: not called CC=4 SCAR=30.0
83 0 my ($self, $call) = @_;
84  
85 0 ▶ unless (blessed $call and $call->isa('Lim::RPC::Call')) {
Branch: 1 branch
BranchTrueFalseTotal
unless (builtin::blessed($call) and $call->isa("Lim::RPC::Call")) 0 0 0
Condition0%0/3
builtin::blessed($call) and $call->isa("Lim::RPC::Call")
!ll&&!rl&&r
000
MC/DC0%0/2
builtin::blessed($call) and $call->isa("Lim::RPC::Call")
builtin::blessed($call) $call->isa("Lim::RPC::Call")
Truth table0%0/3
A and B
A= builtin::blessed($call)B= $call->isa("Lim::RPC::Call")
ABresult
0X0
100
111
86 0 confess __PACKAGE__, ': call is not a Lim::RPC::Call';
87 }
88  
89 0 ▶ unless (exists $self->{call}->{$call}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $self->{"call"}{$call}) 0 0 0
90 0 $self->{call}->{$call} = $call;
91 }
92  
93 0 $self;
94 }
95  
96 =head2 _deleteCall
97  
98 =cut
99  
100 0 ▶sub _deleteCall {
Subroutine _deleteCall: not called CC=4 SCAR=30.0
101 0 my ($self, $call) = @_;
102  
103 0 ▶ unless (blessed $call and $call->isa('Lim::RPC::Call')) {
Branch: 1 branch
BranchTrueFalseTotal
unless (builtin::blessed($call) and $call->isa("Lim::RPC::Call")) 0 0 0
Condition0%0/3
builtin::blessed($call) and $call->isa("Lim::RPC::Call")
!ll&&!rl&&r
000
MC/DC0%0/2
builtin::blessed($call) and $call->isa("Lim::RPC::Call")
builtin::blessed($call) $call->isa("Lim::RPC::Call")
Truth table0%0/3
A and B
A= builtin::blessed($call)B= $call->isa("Lim::RPC::Call")
ABresult
0X0
100
111
104 0 confess __PACKAGE__, ': call is not a Lim::RPC::Call';
105 }
106  
107 0 ▶ if (exists $self->{call}->{$call}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $self->{"call"}{$call}) 0 0 0
108 0 delete $self->{call}->{$call};
109 }
110  
111 0 $self;
112 }
113  
114 =head1 AUTHOR
115  
116 Jerry Lundström, C<< <lundstrom.jerry at gmail.com> >>
117  
118 =head1 BUGS
119  
120 Please report any bugs or feature requests to L<https://github.com/jelu/lim/issues>.
121  
122 =head1 SUPPORT
123  
124 You can find documentation for this module with the perldoc command.
125  
126 perldoc Lim
127  
128 You can also look for information at:
129  
130 =over 4
131  
132 =item * Lim issue tracker (report bugs here)
133  
134 L<https://github.com/jelu/lim/issues>
135  
136 =back
137  
138 =head1 ACKNOWLEDGEMENTS
139  
140 =head1 LICENSE AND COPYRIGHT
141  
142 Copyright 2012-2013 Jerry Lundström.
143  
144 This program is free software; you can redistribute it and/or modify it
145 under the terms of either: the GNU General Public License as published
146 by the Free Software Foundation; or the Artistic License.
147  
148 See http://dev.perl.org/licenses/ for more information.
149  
150  
151 =cut
152  
153 1 1; # End of Lim::Component::Client
« Lim/RPC/Transport/HTTP.pm ↑ Summary Lim/Component/CLI.pm »