| 1 | package Lim::Component; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 10 | ▶ | use common::sense; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 10 | ▶ | use Carp; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | 10 | ▶ | use Log::Log4perl (); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | 10 | ▶ | use Scalar::Util qw(blessed); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | 10 | ▶ | use Lim (); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | 10 | ▶ | use Lim::RPC::Value (); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 11 | 10 | ▶ | use Lim::RPC::Value::Collection (); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 12 | 10 | ▶ | use Lim::RPC::Call (); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | =encoding utf8 | ||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | =head1 NAME | ||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | Lim::Component - Base class for plugins | ||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | =head1 VERSION | ||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | See L<Lim> for version. | ||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | =cut | ||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | 10 | our $VERSION = $Lim::VERSION; | |||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | =over 4 | ||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||
| 32 | package Lim::Plugin::MyPlugin; | ||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | use base qw(Lim::Component); | ||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||
| 36 | sub Name { | ||||||||||||||||||||||||||||
| 37 | 'MyPlugin'; | ||||||||||||||||||||||||||||
| 38 | } | ||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||
| 40 | sub Calls { | ||||||||||||||||||||||||||||
| 41 | { | ||||||||||||||||||||||||||||
| 42 | ReadVersion => { | ||||||||||||||||||||||||||||
| 43 | out => { | ||||||||||||||||||||||||||||
| 44 | version => 'string' | ||||||||||||||||||||||||||||
| 45 | } | ||||||||||||||||||||||||||||
| 46 | } | ||||||||||||||||||||||||||||
| 47 | }; | ||||||||||||||||||||||||||||
| 48 | } | ||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||
| 50 | sub Commands { | ||||||||||||||||||||||||||||
| 51 | { | ||||||||||||||||||||||||||||
| 52 | version => 1 | ||||||||||||||||||||||||||||
| 53 | }; | ||||||||||||||||||||||||||||
| 54 | } | ||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||
| 56 | =back | ||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||
| 58 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||
| 60 | This is the base class of all plugins in Lim. It defines the name, RPC calls and | ||||||||||||||||||||||||||||
| 61 | CLI commands. It must be present for any plugin to work but the different plugin | ||||||||||||||||||||||||||||
| 62 | parts does not have to exist everywhere. For example the CLI part does not have | ||||||||||||||||||||||||||||
| 63 | to have the Server and Client but it will most likly have the Client part if you | ||||||||||||||||||||||||||||
| 64 | want to communicate with the Server. | ||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||
| 66 | =head1 METHODS | ||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||
| 68 | =over 4 | ||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||
| 70 | =item $plugin_name = Lim::Plugin::MyPlugin->Name | ||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||
| 72 | Returns the plugin's name. | ||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||
| 74 | This function must be overloaded or it will L<confess>. | ||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||
| 76 | =cut | ||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||
| 78 | 0 | ▶ | sub Name { | ||||||||||||||||||||||||||
|
Subroutine
Name: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 79 | 0 | confess 'Name not overloaded'; | |||||||||||||||||||||||||||
| 80 | } | ||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||
| 82 | =item $plugin_description = Lim::Plugin::MyPlugin->Description | ||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||
| 84 | Returns the plugin's description. | ||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||
| 86 | =cut | ||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||
| 88 | 0 | ▶ | sub Description { | ||||||||||||||||||||||||||
|
Subroutine
Description: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 89 | 0 | 'No description for this plugin'; | |||||||||||||||||||||||||||
| 90 | } | ||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||
| 92 | =item $call_hash_ref = Lim::Plugin::MyPlugin->Calls | ||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||
| 94 | Returns a hash reference to the calls that can be made to this plugin, used both | ||||||||||||||||||||||||||||
| 95 | in Server and Client to verify input and output arguments. | ||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||
| 97 | Read more about this in L<Lim::Component::Server>. | ||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||
| 99 | This function must be overloaded or it will L<confess>. | ||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||
| 101 | =cut | ||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||
| 103 | 0 | ▶ | sub Calls { | ||||||||||||||||||||||||||
|
Subroutine
Calls: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 104 | 0 | confess 'Calls not overloaded'; | |||||||||||||||||||||||||||
| 105 | } | ||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||
| 107 | =item $command_hash_ref = Lim::Plugin::MyPlugin->Commands | ||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||
| 109 | Returns a hash reference to the CLI commands that can be made by this plugin. | ||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||
| 111 | This function must be overloaded or it will L<confess>. | ||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||
| 113 | =cut | ||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||
| 115 | 0 | ▶ | sub Commands { | ||||||||||||||||||||||||||
|
Subroutine
Commands: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 116 | 0 | confess 'Commands not overloaded'; | |||||||||||||||||||||||||||
| 117 | } | ||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||
| 119 | =item $cli = Lim::Plugin::MyPlugin->CLI | ||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||
| 121 | Create a CLI object of the plugin, read more about this in | ||||||||||||||||||||||||||||
| 122 | L<Lim::Component::CLI>. | ||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||
| 124 | =cut | ||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||
| 126 | 0 | ▶ | sub CLI { | ||||||||||||||||||||||||||
|
Subroutine
CLI: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||
| 127 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||
| 129 | 0 | ▶ | if (ref($self)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 130 | 0 | confess __PACKAGE__, ': Should not be called with refered/blessed argument'; | |||||||||||||||||||||||||||
| 131 | } | ||||||||||||||||||||||||||||
| 132 | 0 | ▶ | unless (defined $self) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 133 | 0 | confess __PACKAGE__, ': CLI not called correctly, should be Module->CLI'; | |||||||||||||||||||||||||||
| 134 | } | ||||||||||||||||||||||||||||
| 135 | 0 | $self .= '::CLI'; | |||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||
| 137 | 0 | eval 'use '.$self.' ();'; | |||||||||||||||||||||||||||
| 138 | 0 | ▶ | if ($@) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 139 | 0 | return; | |||||||||||||||||||||||||||
| 140 | } | ||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||
| 142 | 0 | $self->new(@_); | |||||||||||||||||||||||||||
| 143 | } | ||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||
| 145 | =item $client = Lim::Plugin::MyPlugin->Client | ||||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||
| 147 | Create a Client object of the plugin, read more about this in | ||||||||||||||||||||||||||||
| 148 | L<Lim::Component::Client>. | ||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||
| 150 | =cut | ||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||
| 152 | 0 | ▶ | sub Client { | ||||||||||||||||||||||||||
|
Subroutine
Client: not called CC=29 SCAR=67.0
Pod
documented
| |||||||||||||||||||||||||||||
| 153 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||
| 155 | 0 | ▶ | if (ref($self)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 156 | 0 | confess __PACKAGE__, ': Should not be called with refered/blessed argument'; | |||||||||||||||||||||||||||
| 157 | } | ||||||||||||||||||||||||||||
| 158 | 0 | ▶ | unless (defined $self) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 159 | 0 | confess __PACKAGE__, ': Client not called correctly, should be Module->Client'; | |||||||||||||||||||||||||||
| 160 | } | ||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||
| 162 | # TODO: Can we check if $self->can(...) ? | ||||||||||||||||||||||||||||
| 163 | 0 | my $calls = $self->Calls; | |||||||||||||||||||||||||||
| 164 | 0 | my $plugin = $self->Name; | |||||||||||||||||||||||||||
| 165 | 0 | $self .= '::Client'; | |||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||
| 167 | 0 | eval 'use '.$self.' ();'; | |||||||||||||||||||||||||||
| 168 | 0 | ▶ | if ($@) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 169 | 0 | return; | |||||||||||||||||||||||||||
| 170 | } | ||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||
| 172 | 0 | ▶ | if ($self->can('__lim_bootstrapped')) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 173 | 0 | return $self->new(@_); | |||||||||||||||||||||||||||
| 174 | } | ||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||
| 176 | 10 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 177 | 0 | foreach my $call (keys %$calls) { | |||||||||||||||||||||||||||
| 178 | 0 | ▶ | unless ($self->can($call)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 179 | 0 | my $sub = $self.'::'.$call; | |||||||||||||||||||||||||||
| 180 | 0 | my $call_def = $calls->{$call}; | |||||||||||||||||||||||||||
| 181 | |||||||||||||||||||||||||||||
| 182 | 0 | ▶ | unless (ref($call_def) eq 'HASH') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 183 | 0 | confess __PACKAGE__, ': Can not create client: call ', $call, ' has invalid definition'; | |||||||||||||||||||||||||||
| 184 | } | ||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||
| 186 | 0 | ▶ | if (exists $call_def->{in}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 187 | 0 | ▶ | unless (ref($call_def->{in}) eq 'HASH') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 188 | 0 | confess __PACKAGE__, ': Can not create client: call ', $call, ' has invalid in parameter definition'; | |||||||||||||||||||||||||||
| 189 | } | ||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||
| 191 | 0 | my @keys = keys %{$call_def->{in}}; | |||||||||||||||||||||||||||
| 192 | 0 | ▶ | unless (scalar @keys) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 193 | 0 | confess __PACKAGE__, ': Can not create client: call ', $call, ' has invalid in parameter definition'; | |||||||||||||||||||||||||||
| 194 | } | ||||||||||||||||||||||||||||
| 195 | |||||||||||||||||||||||||||||
| 196 | 0 | my @values = ($call_def->{in}); | |||||||||||||||||||||||||||
| 197 | 0 | ▶ | while (defined (my $value = shift(@values))) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 198 | 0 | foreach my $key (keys %$value) { | |||||||||||||||||||||||||||
| 199 | 0 | ▶ | if (ref($value->{$key}) eq 'HASH') { | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 200 | 0 | ▶ | if (exists $value->{$key}->{''}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 201 | 0 | my $collection = Lim::RPC::Value::Collection->new($value->{$key}->{''}); | |||||||||||||||||||||||||||
| 202 | 0 | delete $value->{$key}->{''}; | |||||||||||||||||||||||||||
| 203 | 0 | $value->{$key} = $collection->set_children($value->{$key}); | |||||||||||||||||||||||||||
| 204 | 0 | push(@values, $value->{$key}->children); | |||||||||||||||||||||||||||
| 205 | } | ||||||||||||||||||||||||||||
| 206 | else { | ||||||||||||||||||||||||||||
| 207 | 0 | push(@values, $value->{$key}); | |||||||||||||||||||||||||||
| 208 | } | ||||||||||||||||||||||||||||
| 209 | 0 | next; | |||||||||||||||||||||||||||
| 210 | } | ||||||||||||||||||||||||||||
| 211 | elsif (blessed $value->{$key}) { | ||||||||||||||||||||||||||||
| 212 | 0 | ▶ | if ($value->{$key}->isa('Lim::RPC::Value')) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 213 | 0 | next; | |||||||||||||||||||||||||||
| 214 | } | ||||||||||||||||||||||||||||
| 215 | 0 | ▶ | if ($value->{$key}->isa('Lim::RPC::Value::Collection')) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 216 | 0 | push(@values, $value->{$key}->children); | |||||||||||||||||||||||||||
| 217 | 0 | next; | |||||||||||||||||||||||||||
| 218 | } | ||||||||||||||||||||||||||||
| 219 | } | ||||||||||||||||||||||||||||
| 220 | else { | ||||||||||||||||||||||||||||
| 221 | 0 | $value->{$key} = Lim::RPC::Value->new($value->{$key}); | |||||||||||||||||||||||||||
| 222 | 0 | next; | |||||||||||||||||||||||||||
| 223 | } | ||||||||||||||||||||||||||||
| 224 | |||||||||||||||||||||||||||||
| 225 | 0 | confess __PACKAGE__, ': Can not create client: call ', $call, ' has invalid in parameter definition'; | |||||||||||||||||||||||||||
| 226 | } | ||||||||||||||||||||||||||||
| 227 | } | ||||||||||||||||||||||||||||
| 228 | } | ||||||||||||||||||||||||||||
| 229 | |||||||||||||||||||||||||||||
| 230 | 0 | ▶ | if (exists $call_def->{out}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 231 | 0 | ▶ | unless (ref($call_def->{out}) eq 'HASH') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 232 | 0 | confess __PACKAGE__, ': Can not create client: call ', $call, ' has invalid out parameter definition'; | |||||||||||||||||||||||||||
| 233 | } | ||||||||||||||||||||||||||||
| 234 | |||||||||||||||||||||||||||||
| 235 | 0 | my @keys = keys %{$call_def->{out}}; | |||||||||||||||||||||||||||
| 236 | 0 | ▶ | unless (scalar @keys) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 237 | 0 | confess __PACKAGE__, ': Can not create client: call ', $call, ' has invalid out parameter definition'; | |||||||||||||||||||||||||||
| 238 | } | ||||||||||||||||||||||||||||
| 239 | |||||||||||||||||||||||||||||
| 240 | 0 | my @values = ($call_def->{out}); | |||||||||||||||||||||||||||
| 241 | 0 | ▶ | while (defined $calls and (my $value = shift(@values))) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $calls and my $value = shift @values
MC/DC0%0/2
defined $calls and my $value = shift @values
defined $calls
my $value = shift @values
Truth table0%0/3
A and B
A= defined $callsB= my $value = shift @values
| |||||||||||||||||||||||||||||
| 242 | 0 | foreach my $key (keys %$value) { | |||||||||||||||||||||||||||
| 243 | 0 | ▶ | if (ref($value->{$key}) eq 'HASH') { | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 244 | 0 | ▶ | if (exists $value->{$key}->{''}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 245 | 0 | my $collection = Lim::RPC::Value::Collection->new($value->{$key}->{''}); | |||||||||||||||||||||||||||
| 246 | 0 | delete $value->{$key}->{''}; | |||||||||||||||||||||||||||
| 247 | 0 | $value->{$key} = $collection->set_children($value->{$key}); | |||||||||||||||||||||||||||
| 248 | 0 | push(@values, $value->{$key}->children); | |||||||||||||||||||||||||||
| 249 | } | ||||||||||||||||||||||||||||
| 250 | else { | ||||||||||||||||||||||||||||
| 251 | 0 | push(@values, $value->{$key}); | |||||||||||||||||||||||||||
| 252 | } | ||||||||||||||||||||||||||||
| 253 | 0 | next; | |||||||||||||||||||||||||||
| 254 | } | ||||||||||||||||||||||||||||
| 255 | elsif (blessed $value->{$key}) { | ||||||||||||||||||||||||||||
| 256 | 0 | ▶ | if ($value->{$key}->isa('Lim::RPC::Value')) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 257 | 0 | next; | |||||||||||||||||||||||||||
| 258 | } | ||||||||||||||||||||||||||||
| 259 | 0 | ▶ | if ($value->{$key}->isa('Lim::RPC::Value::Collection')) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 260 | 0 | push(@values, $value->{$key}->children); | |||||||||||||||||||||||||||
| 261 | 0 | next; | |||||||||||||||||||||||||||
| 262 | } | ||||||||||||||||||||||||||||
| 263 | } | ||||||||||||||||||||||||||||
| 264 | else { | ||||||||||||||||||||||||||||
| 265 | 0 | $value->{$key} = Lim::RPC::Value->new($value->{$key}); | |||||||||||||||||||||||||||
| 266 | 0 | next; | |||||||||||||||||||||||||||
| 267 | } | ||||||||||||||||||||||||||||
| 268 | |||||||||||||||||||||||||||||
| 269 | 0 | confess __PACKAGE__, ': Can not create client: call ', $call, ' has invalid out parameter definition'; | |||||||||||||||||||||||||||
| 270 | } | ||||||||||||||||||||||||||||
| 271 | } | ||||||||||||||||||||||||||||
| 272 | } | ||||||||||||||||||||||||||||
| 273 | |||||||||||||||||||||||||||||
| 274 | 0 | ▶ | *$sub = sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||
| 275 | 0 | ▶ | unless (Lim::RPC::Call->new($plugin, $call, $call_def, @_)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 276 | 0 | confess __PACKAGE__, ': Unable to create Lim::RPC::Call for ', $sub; | |||||||||||||||||||||||||||
| 277 | } | ||||||||||||||||||||||||||||
| 278 | 0 | }; | |||||||||||||||||||||||||||
| 279 | } | ||||||||||||||||||||||||||||
| 280 | } | ||||||||||||||||||||||||||||
| 281 | |||||||||||||||||||||||||||||
| 282 | 0 | my $sub = $self.'::__lim_bootstrapped'; | |||||||||||||||||||||||||||
| 283 | 0 | ▶ | *$sub = sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 284 | 0 | 1; | |||||||||||||||||||||||||||
| 285 | 0 | }; | |||||||||||||||||||||||||||
| 286 | |||||||||||||||||||||||||||||
| 287 | 0 | $self->new(@_); | |||||||||||||||||||||||||||
| 288 | } | ||||||||||||||||||||||||||||
| 289 | |||||||||||||||||||||||||||||
| 290 | =item $client = Lim::Plugin::MyPlugin->Server | ||||||||||||||||||||||||||||
| 291 | |||||||||||||||||||||||||||||
| 292 | Create a Server object of the plugin, read more about this in | ||||||||||||||||||||||||||||
| 293 | L<Lim::Component::Server>. | ||||||||||||||||||||||||||||
| 294 | |||||||||||||||||||||||||||||
| 295 | =cut | ||||||||||||||||||||||||||||
| 296 | |||||||||||||||||||||||||||||
| 297 | 4 | ▶ | sub Server { | ||||||||||||||||||||||||||
|
Subroutine
Server: called CC=4 SCAR=15.0
Pod
documented
| |||||||||||||||||||||||||||||
| 298 | 4 | my $self = shift; | |||||||||||||||||||||||||||
| 299 | |||||||||||||||||||||||||||||
| 300 | 4 | ▶ | if (ref($self)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 301 | 0 | confess __PACKAGE__, ': Should not be called with refered/blessed argument'; | |||||||||||||||||||||||||||
| 302 | } | ||||||||||||||||||||||||||||
| 303 | 4 | ▶ | unless (defined $self) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 304 | 0 | confess __PACKAGE__, ': Server not called correctly, should be Module->Server'; | |||||||||||||||||||||||||||
| 305 | } | ||||||||||||||||||||||||||||
| 306 | 4 | $self .= '::Server'; | |||||||||||||||||||||||||||
| 307 | |||||||||||||||||||||||||||||
| 308 | 4 | ▶ | eval 'use '.$self.' ();'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 309 | 4 | ▶ | if ($@) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 310 | 0 | return; | |||||||||||||||||||||||||||
| 311 | } | ||||||||||||||||||||||||||||
| 312 | |||||||||||||||||||||||||||||
| 313 | 4 | $self->new(@_); | |||||||||||||||||||||||||||
| 314 | } | ||||||||||||||||||||||||||||
| 315 | |||||||||||||||||||||||||||||
| 316 | =back | ||||||||||||||||||||||||||||
| 317 | |||||||||||||||||||||||||||||
| 318 | =head1 AUTHOR | ||||||||||||||||||||||||||||
| 319 | |||||||||||||||||||||||||||||
| 320 | Jerry Lundström, C<< <lundstrom.jerry at gmail.com> >> | ||||||||||||||||||||||||||||
| 321 | |||||||||||||||||||||||||||||
| 322 | =head1 BUGS | ||||||||||||||||||||||||||||
| 323 | |||||||||||||||||||||||||||||
| 324 | Please report any bugs or feature requests to L<https://github.com/jelu/lim/issues>. | ||||||||||||||||||||||||||||
| 325 | |||||||||||||||||||||||||||||
| 326 | =head1 SUPPORT | ||||||||||||||||||||||||||||
| 327 | |||||||||||||||||||||||||||||
| 328 | You can find documentation for this module with the perldoc command. | ||||||||||||||||||||||||||||
| 329 | |||||||||||||||||||||||||||||
| 330 | perldoc Lim::Component | ||||||||||||||||||||||||||||
| 331 | |||||||||||||||||||||||||||||
| 332 | You can also look for information at: | ||||||||||||||||||||||||||||
| 333 | |||||||||||||||||||||||||||||
| 334 | =over 4 | ||||||||||||||||||||||||||||
| 335 | |||||||||||||||||||||||||||||
| 336 | =item * Lim issue tracker (report bugs here) | ||||||||||||||||||||||||||||
| 337 | |||||||||||||||||||||||||||||
| 338 | L<https://github.com/jelu/lim/issues> | ||||||||||||||||||||||||||||
| 339 | |||||||||||||||||||||||||||||
| 340 | =back | ||||||||||||||||||||||||||||
| 341 | |||||||||||||||||||||||||||||
| 342 | =head1 ACKNOWLEDGEMENTS | ||||||||||||||||||||||||||||
| 343 | |||||||||||||||||||||||||||||
| 344 | =head1 LICENSE AND COPYRIGHT | ||||||||||||||||||||||||||||
| 345 | |||||||||||||||||||||||||||||
| 346 | Copyright 2012-2013 Jerry Lundström. | ||||||||||||||||||||||||||||
| 347 | |||||||||||||||||||||||||||||
| 348 | This program is free software; you can redistribute it and/or modify it | ||||||||||||||||||||||||||||
| 349 | under the terms of either: the GNU General Public License as published | ||||||||||||||||||||||||||||
| 350 | by the Free Software Foundation; or the Artistic License. | ||||||||||||||||||||||||||||
| 351 | |||||||||||||||||||||||||||||
| 352 | See http://dev.perl.org/licenses/ for more information. | ||||||||||||||||||||||||||||
| 353 | |||||||||||||||||||||||||||||
| 354 | |||||||||||||||||||||||||||||
| 355 | =cut | ||||||||||||||||||||||||||||
| 356 | |||||||||||||||||||||||||||||
| 357 | 10 | 1; # End of Lim::Component | |||||||||||||||||||||||||||