| 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 | 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
MC/DC0%0/2
ref $this || $this
ref $this
$this
Truth table33%1/3
A || B
A= ref $thisB= $this
| |||||||||||||||||||||||||||||
| 38 | 4 | my %args = ( @_ ); | |||||||||||||||||||||||||||
| 39 | 4 | my $self = { | |||||||||||||||||||||||||||
| 40 | logger => Log::Log4perl->get_logger | ||||||||||||||||||||||||||||
| 41 | }; | ||||||||||||||||||||||||||||
| 42 | 4 | bless $self, $class; | |||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | 4 | ▶ | unless (blessed($args{server}) and $args{server}->isa('Lim::RPC::Server')) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
builtin::blessed($args{"server"}) and $args{"server"}->isa("Lim::RPC::Server")
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")
| |||||||||||||||||||||||||||||
| 45 | 0 | confess __PACKAGE__, ': No server specified or invalid'; | |||||||||||||||||||||||||||
| 46 | } | ||||||||||||||||||||||||||||
| 47 | 4 | $self->{__server} = $args{server}; | |||||||||||||||||||||||||||
| 48 | 4 | weaken($self->{__server}); | |||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||
| 50 | 4 | $self->Init(@_); | |||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||
| 52 | 4 | ▶ | Lim::OBJ_DEBUG and $self->{logger}->debug('new ', __PACKAGE__, ' ', $self); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 53 | 4 | $self; | |||||||||||||||||||||||||||
| 54 | } | ||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||
| 56 | sub DESTROY { | ||||||||||||||||||||||||||||
| 57 | 4 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||
|
Subroutine
DESTROY: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||
| 58 | 4 | ▶ | Lim::OBJ_DEBUG and $self->{logger}->debug('destroy ', __PACKAGE__, ' ', $self); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||
| 60 | 4 | $self->Destroy; | |||||||||||||||||||||||||||
| 61 | 4 | delete $self->{__server}; | |||||||||||||||||||||||||||
| 62 | } | ||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||
| 64 | =head2 Init | ||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||
| 66 | =cut | ||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||
| 68 | ▶ | sub Init { | |||||||||||||||||||||||||||
|
Subroutine
Init: not called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 69 | } | ||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||
| 71 | =head2 Destroy | ||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||
| 73 | =cut | ||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||
| 75 | ▶ | sub Destroy { | |||||||||||||||||||||||||||
|
Subroutine
Destroy: not called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 76 | } | ||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||
| 78 | =head2 name | ||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||
| 80 | =cut | ||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||
| 82 | sub name { | ||||||||||||||||||||||||||||
| 83 | 0 | ▶ | confess 'function name not overloaded'; | ||||||||||||||||||||||||||
|
Subroutine
name: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 84 | } | ||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||
| 86 | =head2 serve | ||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||
| 88 | =cut | ||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||
| 90 | sub serve { | ||||||||||||||||||||||||||||
| 91 | 0 | ▶ | confess 'function serve not overloaded'; | ||||||||||||||||||||||||||
|
Subroutine
serve: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 92 | } | ||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||
| 94 | =head2 handle | ||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||
| 96 | =cut | ||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||
| 98 | sub handle { | ||||||||||||||||||||||||||||
| 99 | 0 | ▶ | confess 'function handle not overloaded'; | ||||||||||||||||||||||||||
|
Subroutine
handle: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 100 | } | ||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||
| 102 | =head2 timeout | ||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||
| 104 | =cut | ||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||
| 106 | sub timeout { | ||||||||||||||||||||||||||||
| 107 | 0 | ▶ | confess 'function timeout not overloaded'; | ||||||||||||||||||||||||||
|
Subroutine
timeout: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 108 | } | ||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||
| 110 | =head2 server | ||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||
| 112 | =cut | ||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||
| 114 | sub server { | ||||||||||||||||||||||||||||
| 115 | 6 | ▶ | $_[0]->{__server}; | ||||||||||||||||||||||||||
|
Subroutine
server: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 116 | } | ||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||
| 118 | =head2 precall | ||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||
| 120 | =cut | ||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||
| 122 | sub precall { | ||||||||||||||||||||||||||||
| 123 | 2 | ▶ | shift; # $self | ||||||||||||||||||||||||||
|
Subroutine
precall: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 124 | 2 | shift; # $call | |||||||||||||||||||||||||||
| 125 | 2 | return @_; | |||||||||||||||||||||||||||
| 126 | } | ||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||
| 128 | =head1 AUTHOR | ||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||
| 130 | Jerry Lundström, C<< <lundstrom.jerry at gmail.com> >> | ||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||
| 132 | =head1 BUGS | ||||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||
| 134 | Please report any bugs or feature requests to L<https://github.com/jelu/lim/issues>. | ||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||
| 136 | =head1 SUPPORT | ||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||
| 138 | You can find documentation for this module with the perldoc command. | ||||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||
| 140 | perldoc Lim | ||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||
| 142 | You can also look for information at: | ||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||
| 144 | =over 4 | ||||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||
| 146 | =item * Lim issue tracker (report bugs here) | ||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||
| 148 | L<https://github.com/jelu/lim/issues> | ||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||
| 150 | =back | ||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||
| 152 | =head1 ACKNOWLEDGEMENTS | ||||||||||||||||||||||||||||
| 153 | |||||||||||||||||||||||||||||
| 154 | =head1 LICENSE AND COPYRIGHT | ||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||
| 156 | Copyright 2012-2013 Jerry Lundström. | ||||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||
| 158 | This program is free software; you can redistribute it and/or modify it | ||||||||||||||||||||||||||||
| 159 | under the terms of either: the GNU General Public License as published | ||||||||||||||||||||||||||||
| 160 | by the Free Software Foundation; or the Artistic License. | ||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||
| 162 | See http://dev.perl.org/licenses/ for more information. | ||||||||||||||||||||||||||||
| 163 | |||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||
| 165 | =cut | ||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||
| 167 | 5 | 1; # End of Lim::RPC::Protocol | |||||||||||||||||||||||||||