| 1 | package Lim::Agent::Server; | ||||||||||
| 2 | |||||||||||
| 3 | 5 | ▶ | use common::sense; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | |||||||||||
| 5 | 5 | ▶ | use Lim (); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 5 | ▶ | use Lim::Plugins (); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | 5 | ▶ | use base qw(Lim::Component::Server); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | |||||||||||
| 10 | =encoding utf8 | ||||||||||
| 11 | |||||||||||
| 12 | =head1 NAME | ||||||||||
| 13 | |||||||||||
| 14 | ... | ||||||||||
| 15 | |||||||||||
| 16 | =head1 VERSION | ||||||||||
| 17 | |||||||||||
| 18 | See L<Lim> for version. | ||||||||||
| 19 | |||||||||||
| 20 | =cut | ||||||||||
| 21 | |||||||||||
| 22 | 5 | our $VERSION = $Lim::VERSION; | |||||||||
| 23 | |||||||||||
| 24 | =head1 SYNOPSIS | ||||||||||
| 25 | |||||||||||
| 26 | ... | ||||||||||
| 27 | |||||||||||
| 28 | =head1 SUBROUTINES/METHODS | ||||||||||
| 29 | |||||||||||
| 30 | =head2 ReadVersion | ||||||||||
| 31 | |||||||||||
| 32 | =cut | ||||||||||
| 33 | |||||||||||
| 34 | 4 | ▶ | sub ReadVersion { | ||||||||
|
Subroutine
ReadVersion: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 35 | 4 | my ($self, $cb) = @_; | |||||||||
| 36 | |||||||||||
| 37 | 4 | $self->Successful($cb, { version => $VERSION }); | |||||||||
| 38 | } | ||||||||||
| 39 | |||||||||||
| 40 | =head2 ReadPlugins | ||||||||||
| 41 | |||||||||||
| 42 | =cut | ||||||||||
| 43 | |||||||||||
| 44 | 0 | ▶ | sub ReadPlugins { | ||||||||
|
Subroutine
ReadPlugins: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 45 | 0 | my ($self, $cb) = @_; | |||||||||
| 46 | |||||||||||
| 47 | 0 | $self->Successful($cb, { plugin => [ { | |||||||||
| 48 | name => Lim::Agent->Name, | ||||||||||
| 49 | description => Lim::Agent->Description, | ||||||||||
| 50 | module => 'Lim::Agent', | ||||||||||
| 51 | version => $VERSION, | ||||||||||
| 52 | loaded => 1 }, | ||||||||||
| 53 | Lim::Plugins->instance->All | ||||||||||
| 54 | ] }); | ||||||||||
| 55 | } | ||||||||||
| 56 | |||||||||||
| 57 | =head2 ReadPlugin | ||||||||||
| 58 | |||||||||||
| 59 | =cut | ||||||||||
| 60 | |||||||||||
| 61 | 0 | ▶ | sub ReadPlugin { | ||||||||
|
Subroutine
ReadPlugin: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||
| 62 | 0 | my ($self, $cb, $q) = @_; | |||||||||
| 63 | 0 | my @plugins = ( Lim::Plugins->instance->All ); | |||||||||
| 64 | 0 | my $result = { | |||||||||
| 65 | plugin => [ { | ||||||||||
| 66 | name => Lim::Agent->Name, | ||||||||||
| 67 | description => Lim::Agent->Description, | ||||||||||
| 68 | module => 'Lim::Agent', | ||||||||||
| 69 | version => $VERSION, | ||||||||||
| 70 | loaded => 1 | ||||||||||
| 71 | } ] | ||||||||||
| 72 | }; | ||||||||||
| 73 | |||||||||||
| 74 | 0 | ▶ | foreach my $plugin (ref($q->{plugin}) eq 'ARRAY' ? @{$q->{plugin}} : $q->{plugin}) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 75 | 0 | foreach my $loaded (@plugins) { | |||||||||
| 76 | 0 | ▶ | if (lc($loaded->{name}) eq $plugin->{name}) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 77 | 0 | push(@{$result->{plugin}}, $loaded); | |||||||||
| 78 | } | ||||||||||
| 79 | } | ||||||||||
| 80 | } | ||||||||||
| 81 | 0 | $self->Successful($cb, $result); | |||||||||
| 82 | } | ||||||||||
| 83 | |||||||||||
| 84 | =head2 ReadPluginVersion | ||||||||||
| 85 | |||||||||||
| 86 | =cut | ||||||||||
| 87 | |||||||||||
| 88 | 0 | ▶ | sub ReadPluginVersion { | ||||||||
|
Subroutine
ReadPluginVersion: not called CC=6 SCAR=37.4
Pod
documented
| |||||||||||
| 89 | 0 | my ($self, $cb, $q) = @_; | |||||||||
| 90 | 0 | my @plugins = ( Lim::Plugins->instance->All ); | |||||||||
| 91 | 0 | my $result = {}; | |||||||||
| 92 | |||||||||||
| 93 | 0 | ▶ | foreach my $plugin (ref($q->{plugin}) eq 'ARRAY' ? @{$q->{plugin}} : $q->{plugin}) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 94 | 0 | ▶ | if ($plugin->{name} eq Lim::Agent->Name) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 95 | 0 | push(@{$result->{plugin}}, { | |||||||||
| 96 | name => Lim::Agent->Name, | ||||||||||
| 97 | version => $VERSION | ||||||||||
| 98 | }); | ||||||||||
| 99 | 0 | next; | |||||||||
| 100 | } | ||||||||||
| 101 | 0 | foreach my $loaded (@plugins) { | |||||||||
| 102 | 0 | ▶ | if (lc($loaded->{name}) eq $plugin->{name}) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 103 | 0 | push(@{$result->{plugin}}, { | |||||||||
| 104 | name => $loaded->{name}, | ||||||||||
| 105 | version => $loaded->{version} | ||||||||||
| 106 | 0 | }); | |||||||||
| 107 | } | ||||||||||
| 108 | } | ||||||||||
| 109 | } | ||||||||||
| 110 | 0 | $self->Successful($cb, $result); | |||||||||
| 111 | } | ||||||||||
| 112 | |||||||||||
| 113 | =head2 ReadPluginLoaded | ||||||||||
| 114 | |||||||||||
| 115 | =cut | ||||||||||
| 116 | |||||||||||
| 117 | 0 | ▶ | sub ReadPluginLoaded { | ||||||||
|
Subroutine
ReadPluginLoaded: not called CC=6 SCAR=37.4
Pod
documented
| |||||||||||
| 118 | 0 | my ($self, $cb, $q) = @_; | |||||||||
| 119 | 0 | my @plugins = ( Lim::Plugins->instance->All ); | |||||||||
| 120 | 0 | my $result = {}; | |||||||||
| 121 | |||||||||||
| 122 | 0 | ▶ | foreach my $plugin (ref($q->{plugin}) eq 'ARRAY' ? @{$q->{plugin}} : $q->{plugin}) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 123 | 0 | ▶ | if ($plugin->{name} eq Lim::Agent->Name) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 124 | 0 | push(@{$result->{plugin}}, { | |||||||||
| 125 | name => Lim::Agent->Name, | ||||||||||
| 126 | loaded => 1 | ||||||||||
| 127 | }); | ||||||||||
| 128 | 0 | next; | |||||||||
| 129 | } | ||||||||||
| 130 | 0 | foreach my $loaded (@plugins) { | |||||||||
| 131 | 0 | ▶ | if (lc($loaded->{name}) eq $plugin->{name}) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 132 | 0 | push(@{$result->{plugin}}, { | |||||||||
| 133 | name => $loaded->{name}, | ||||||||||
| 134 | loaded => $loaded->{loaded} | ||||||||||
| 135 | 0 | }); | |||||||||
| 136 | } | ||||||||||
| 137 | } | ||||||||||
| 138 | } | ||||||||||
| 139 | 0 | $self->Successful($cb, $result); | |||||||||
| 140 | } | ||||||||||
| 141 | |||||||||||
| 142 | =head1 AUTHOR | ||||||||||
| 143 | |||||||||||
| 144 | Jerry Lundström, C<< <lundstrom.jerry at gmail.com> >> | ||||||||||
| 145 | |||||||||||
| 146 | =head1 BUGS | ||||||||||
| 147 | |||||||||||
| 148 | Please report any bugs or feature requests to L<https://github.com/jelu/lim/issues>. | ||||||||||
| 149 | |||||||||||
| 150 | =head1 SUPPORT | ||||||||||
| 151 | |||||||||||
| 152 | You can find documentation for this module with the perldoc command. | ||||||||||
| 153 | |||||||||||
| 154 | perldoc Lim | ||||||||||
| 155 | |||||||||||
| 156 | You can also look for information at: | ||||||||||
| 157 | |||||||||||
| 158 | =over 4 | ||||||||||
| 159 | |||||||||||
| 160 | =item * Lim issue tracker (report bugs here) | ||||||||||
| 161 | |||||||||||
| 162 | L<https://github.com/jelu/lim/issues> | ||||||||||
| 163 | |||||||||||
| 164 | =back | ||||||||||
| 165 | |||||||||||
| 166 | =head1 ACKNOWLEDGEMENTS | ||||||||||
| 167 | |||||||||||
| 168 | =head1 LICENSE AND COPYRIGHT | ||||||||||
| 169 | |||||||||||
| 170 | Copyright 2012-2013 Jerry Lundström. | ||||||||||
| 171 | |||||||||||
| 172 | This program is free software; you can redistribute it and/or modify it | ||||||||||
| 173 | under the terms of either: the GNU General Public License as published | ||||||||||
| 174 | by the Free Software Foundation; or the Artistic License. | ||||||||||
| 175 | |||||||||||
| 176 | See http://dev.perl.org/licenses/ for more information. | ||||||||||
| 177 | |||||||||||
| 178 | |||||||||||
| 179 | =cut | ||||||||||
| 180 | |||||||||||
| 181 | 5 | 1; # End of Lim::Agent | |||||||||