Lim/Component/Client.pm

filter: Statementstmt 39.5% 17 / 43 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.4% 25 / 88 SCAR 42.9
CC
12
Cov
25%
new
30.0
_addCall
20.0
_deleteCall
20.0
CRAP 72.8
« Lim/RPC/Value.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);
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 sub new {
36 0 ▶ my $this = shift;
Subroutine new: not called CC=5 SCAR=34.0
Pod documented
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,
40 call => {}
41 };
42 0 bless $self, $class;
43  
44 0 eval {
45 0 $self->Init(@_);
46 };
47 0 ▶ if ($@) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 0 0
48 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
49 0 return;
50 }
51
52 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
53 0 $self;
54 }
55  
56 sub DESTROY {
57 0 ▶ my ($self) = @_;
Subroutine DESTROY: not called CC=2 SCAR=17.9
58 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
59
60 0 $self->Destroy;
61 }
62  
63 =head2 Init
64  
65 =cut
66  
67 ▶sub Init {
Subroutine Init: not called CC=1 SCAR=0.0
Pod documented
68 }
69  
70 =head2 Destroy
71  
72 =cut
73  
74 ▶sub Destroy {
Subroutine Destroy: not called CC=1 SCAR=0.0
Pod documented
75 }
76  
77 =head2 _addCall
78  
79 =cut
80  
81 sub _addCall {
82 0 ▶ my ($self, $call) = @_;
Subroutine _addCall: not called CC=4 SCAR=30.0
83  
84 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
85 0 confess __PACKAGE__, ': call is not a Lim::RPC::Call';
86 }
87
88 0 ▶ unless (exists $self->{call}->{$call}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $self->{"call"}{$call}) 0 0 0
89 0 $self->{call}->{$call} = $call;
90 }
91
92 0 $self;
93 }
94  
95 =head2 _deleteCall
96  
97 =cut
98  
99 sub _deleteCall {
100 0 ▶ my ($self, $call) = @_;
Subroutine _deleteCall: not called CC=4 SCAR=30.0
101  
102 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
103 0 confess __PACKAGE__, ': call is not a Lim::RPC::Call';
104 }
105
106 0 ▶ if (exists $self->{call}->{$call}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $self->{"call"}{$call}) 0 0 0
107 0 delete $self->{call}->{$call};
108 }
109
110 0 $self;
111 }
112  
113 =head1 AUTHOR
114  
115 Jerry Lundström, C<< <lundstrom.jerry at gmail.com> >>
116  
117 =head1 BUGS
118  
119 Please report any bugs or feature requests to L<https://github.com/jelu/lim/issues>.
120  
121 =head1 SUPPORT
122  
123 You can find documentation for this module with the perldoc command.
124  
125 perldoc Lim
126  
127 You can also look for information at:
128  
129 =over 4
130  
131 =item * Lim issue tracker (report bugs here)
132  
133 L<https://github.com/jelu/lim/issues>
134  
135 =back
136  
137 =head1 ACKNOWLEDGEMENTS
138  
139 =head1 LICENSE AND COPYRIGHT
140  
141 Copyright 2012-2013 Jerry Lundström.
142  
143 This program is free software; you can redistribute it and/or modify it
144 under the terms of either: the GNU General Public License as published
145 by the Free Software Foundation; or the Artistic License.
146  
147 See http://dev.perl.org/licenses/ for more information.
148  
149  
150 =cut
151  
152 1 1; # End of Lim::Component::Client
« Lim/RPC/Value.pm ↑ Summary Lim/Component/CLI.pm »