| 1 | package Lim::Agent::CLI; | ||||||||||
| 2 | |||||||||||
| 3 | 1 | ▶ | use common::sense; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | |||||||||||
| 5 | 1 | ▶ | use Scalar::Util qw(weaken); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | 1 | ▶ | use Lim (); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | 1 | ▶ | use Lim::Agent (); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | |||||||||||
| 10 | 1 | ▶ | use base qw(Lim::Component::CLI); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 11 | |||||||||||
| 12 | =encoding utf8 | ||||||||||
| 13 | |||||||||||
| 14 | =head1 NAME | ||||||||||
| 15 | |||||||||||
| 16 | ... | ||||||||||
| 17 | |||||||||||
| 18 | =head1 VERSION | ||||||||||
| 19 | |||||||||||
| 20 | See L<Lim> for version. | ||||||||||
| 21 | |||||||||||
| 22 | =cut | ||||||||||
| 23 | |||||||||||
| 24 | 1 | our $VERSION = $Lim::VERSION; | |||||||||
| 25 | |||||||||||
| 26 | =head1 SYNOPSIS | ||||||||||
| 27 | |||||||||||
| 28 | ... | ||||||||||
| 29 | |||||||||||
| 30 | =head1 SUBROUTINES/METHODS | ||||||||||
| 31 | |||||||||||
| 32 | =head2 version | ||||||||||
| 33 | |||||||||||
| 34 | =cut | ||||||||||
| 35 | |||||||||||
| 36 | 0 | ▶ | sub version { | ||||||||
|
Subroutine
version: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 37 | 0 | my ($self) = @_; | |||||||||
| 38 | 0 | my $agent = Lim::Agent->Client; | |||||||||
| 39 | |||||||||||
| 40 | 0 | weaken($self); | |||||||||
| 41 | 0 | ▶ | $agent->ReadVersion(sub { | ||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||
| 42 | 0 | my ($call, $response) = @_; | |||||||||
| 43 | |||||||||||
| 44 | 0 | ▶ | if ($call->Successful) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 45 | 0 | $self->cli->println('agent version ', $response->{version}); | |||||||||
| 46 | 0 | $self->Successful; | |||||||||
| 47 | } | ||||||||||
| 48 | else { | ||||||||||
| 49 | 0 | $self->Error($call->Error); | |||||||||
| 50 | } | ||||||||||
| 51 | 0 | undef($agent); | |||||||||
| 52 | 0 | }); | |||||||||
| 53 | } | ||||||||||
| 54 | |||||||||||
| 55 | =head2 plugins | ||||||||||
| 56 | |||||||||||
| 57 | =cut | ||||||||||
| 58 | |||||||||||
| 59 | 0 | ▶ | sub plugins { | ||||||||
|
Subroutine
plugins: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 60 | 0 | my ($self) = @_; | |||||||||
| 61 | 0 | my $agent = Lim::Agent->Client; | |||||||||
| 62 | |||||||||||
| 63 | 0 | weaken($self); | |||||||||
| 64 | 0 | ▶ | $agent->ReadPlugins(sub { | ||||||||
|
Subroutine
__ANON__: not called CC=5 SCAR=34.0
| |||||||||||
| 65 | 0 | my ($call, $response) = @_; | |||||||||
| 66 | |||||||||||
| 67 | 0 | ▶ | if ($call->Successful) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 68 | 0 | ▶ | if (exists $response->{plugin}) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 69 | 0 | $self->cli->println(join("\t", qw(Name Description Module Version))); | |||||||||
| 70 | 0 | ▶ | foreach my $plugin (ref($response->{plugin}) eq 'ARRAY' ? @{$response->{plugin}} : $response->{plugin}) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 71 | 0 | $self->cli->println(join("\t", $plugin->{name}, $plugin->{description}, $plugin->{module}, $plugin->{version})); | |||||||||
| 72 | } | ||||||||||
| 73 | } | ||||||||||
| 74 | 0 | $self->Successful; | |||||||||
| 75 | } | ||||||||||
| 76 | else { | ||||||||||
| 77 | 0 | $self->Error($call->Error); | |||||||||
| 78 | } | ||||||||||
| 79 | 0 | undef($agent); | |||||||||
| 80 | 0 | }); | |||||||||
| 81 | } | ||||||||||
| 82 | |||||||||||
| 83 | =head1 AUTHOR | ||||||||||
| 84 | |||||||||||
| 85 | Jerry Lundström, C<< <lundstrom.jerry at gmail.com> >> | ||||||||||
| 86 | |||||||||||
| 87 | =head1 BUGS | ||||||||||
| 88 | |||||||||||
| 89 | Please report any bugs or feature requests to L<https://github.com/jelu/lim/issues>. | ||||||||||
| 90 | |||||||||||
| 91 | =head1 SUPPORT | ||||||||||
| 92 | |||||||||||
| 93 | You can find documentation for this module with the perldoc command. | ||||||||||
| 94 | |||||||||||
| 95 | perldoc Lim | ||||||||||
| 96 | |||||||||||
| 97 | You can also look for information at: | ||||||||||
| 98 | |||||||||||
| 99 | =over 4 | ||||||||||
| 100 | |||||||||||
| 101 | =item * Lim issue tracker (report bugs here) | ||||||||||
| 102 | |||||||||||
| 103 | L<https://github.com/jelu/lim/issues> | ||||||||||
| 104 | |||||||||||
| 105 | =back | ||||||||||
| 106 | |||||||||||
| 107 | =head1 ACKNOWLEDGEMENTS | ||||||||||
| 108 | |||||||||||
| 109 | =head1 LICENSE AND COPYRIGHT | ||||||||||
| 110 | |||||||||||
| 111 | Copyright 2012-2013 Jerry Lundström. | ||||||||||
| 112 | |||||||||||
| 113 | This program is free software; you can redistribute it and/or modify it | ||||||||||
| 114 | under the terms of either: the GNU General Public License as published | ||||||||||
| 115 | by the Free Software Foundation; or the Artistic License. | ||||||||||
| 116 | |||||||||||
| 117 | See http://dev.perl.org/licenses/ for more information. | ||||||||||
| 118 | |||||||||||
| 119 | |||||||||||
| 120 | =cut | ||||||||||
| 121 | |||||||||||
| 122 | 1 | 1; # End of Lim::Agent::CLI | |||||||||