File Coverage

blib/lib/Lim/Component/Client.pm
Criterion Covered Total %
statement 15 43 34.8
branch 0 16 0.0
condition 0 9 0.0
subroutine 5 11 45.4
pod 3 3 100.0
total 23 82 28.0


line stmt bran cond sub pod time code
1             package Lim::Component::Client;
2              
3 1     1   7 use common::sense;
  1         3  
  1         7  
4 1     1   54 use Carp;
  1         3  
  1         90  
5              
6 1     1   8 use Log::Log4perl ();
  1         2  
  1         25  
7 1     1   7 use Scalar::Util qw(blessed);
  1         2  
  1         58  
8              
9 1     1   8 use Lim ();
  1         1  
  1         709  
10              
11             =encoding utf8
12              
13             =head1 NAME
14              
15             ...
16              
17             =head1 VERSION
18              
19             See L for version.
20              
21             =cut
22              
23             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     0 1   my $this = shift;
37 0   0       my $class = ref($this) || $this;
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 0         if ($@) {
48 0 0         Lim::WARN and $self->{logger}->warn('Unable to initialize module '.$class.': '.$@);
49 0           return;
50             }
51            
52 0 0         Lim::OBJ_DEBUG and $self->{logger}->debug('new ', __PACKAGE__, ' ', $self);
53 0           $self;
54             }
55              
56             sub DESTROY {
57 0     0     my ($self) = @_;
58 0 0         Lim::OBJ_DEBUG and $self->{logger}->debug('destroy ', __PACKAGE__, ' ', $self);
59            
60 0           $self->Destroy;
61             }
62              
63             =head2 Init
64              
65             =cut
66              
67 0     0 1   sub Init {
68             }
69              
70             =head2 Destroy
71              
72             =cut
73              
74 0     0 1   sub Destroy {
75             }
76              
77             =head2 _addCall
78              
79             =cut
80              
81             sub _addCall {
82 0     0     my ($self, $call) = @_;
83              
84 0 0 0       unless (blessed $call and $call->isa('Lim::RPC::Call')) {
85 0           confess __PACKAGE__, ': call is not a Lim::RPC::Call';
86             }
87            
88 0 0         unless (exists $self->{call}->{$call}) {
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     0     my ($self, $call) = @_;
101              
102 0 0 0       unless (blessed $call and $call->isa('Lim::RPC::Call')) {
103 0           confess __PACKAGE__, ': call is not a Lim::RPC::Call';
104             }
105            
106 0 0         if (exists $self->{call}->{$call}) {
107 0           delete $self->{call}->{$call};
108             }
109            
110 0           $self;
111             }
112              
113             =head1 AUTHOR
114              
115             Jerry Lundström, C<< >>
116              
117             =head1 BUGS
118              
119             Please report any bugs or feature requests to L.
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
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; # End of Lim::Component::Client