Lim/Agent/CLI.pm

filter: Statementstmt 42.5% 17 / 40 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 55.5% 5 / 9 Podpod 100% 2 / 2 totaltotal 43.6% 24 / 55 SCAR 20.4
CC
4
Cov
39%
__ANON__
12.0
__ANON__
6.0
version
2.0
CRAP 7.7
« Lim/RPC/Callback.pm ↑ Summary Lim/RPC/Protocol.pm »
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 sub version {
37 0 ▶ my ($self) = @_;
Subroutine version: not called CC=1 SCAR=6.9
Pod documented
38 0 my $agent = Lim::Agent->Client;
39
40 0 weaken($self);
41 $agent->ReadVersion(sub {
42 0 ▶ my ($call, $response) = @_;
Subroutine __ANON__: not called CC=2 SCAR=17.9
43
44 0 ▶ if ($call->Successful) {
Branch: 1 branch
BranchTrueFalseTotal
if ($call->Successful) { } 0 0 0
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 sub plugins {
60 0 ▶ my ($self) = @_;
Subroutine plugins: not called CC=1 SCAR=6.9
Pod documented
61 0 my $agent = Lim::Agent->Client;
62
63 0 weaken($self);
64 $agent->ReadPlugins(sub {
65 0 ▶ my ($call, $response) = @_;
Subroutine __ANON__: not called CC=3 SCAR=24.8
66
67 0 ▶ if ($call->Successful) {
Branch: 1 branch
BranchTrueFalseTotal
if ($call->Successful) { } 0 0 0
68 0 $self->cli->println(join("\t", qw(Name Description Module Version)));
69 0 foreach my $plugin (@{$response->{plugin}}) {
70 0 $self->cli->println(join("\t", $plugin->{name}, $plugin->{description}, $plugin->{module}, $plugin->{version}));
71 }
72 0 $self->Successful;
73 }
74 else {
75 0 $self->Error($call->Error);
76 }
77 0 undef($agent);
78 0 });
79 }
80  
81 =head1 AUTHOR
82  
83 Jerry Lundström, C<< <lundstrom.jerry at gmail.com> >>
84  
85 =head1 BUGS
86  
87 Please report any bugs or feature requests to L<https://github.com/jelu/lim/issues>.
88  
89 =head1 SUPPORT
90  
91 You can find documentation for this module with the perldoc command.
92  
93 perldoc Lim
94  
95 You can also look for information at:
96  
97 =over 4
98  
99 =item * Lim issue tracker (report bugs here)
100  
101 L<https://github.com/jelu/lim/issues>
102  
103 =back
104  
105 =head1 ACKNOWLEDGEMENTS
106  
107 =head1 LICENSE AND COPYRIGHT
108  
109 Copyright 2012-2013 Jerry Lundström.
110  
111 This program is free software; you can redistribute it and/or modify it
112 under the terms of either: the GNU General Public License as published
113 by the Free Software Foundation; or the Artistic License.
114  
115 See http://dev.perl.org/licenses/ for more information.
116  
117  
118 =cut
119  
120 1 1; # End of Lim::Agent::CLI
« Lim/RPC/Callback.pm ↑ Summary Lim/RPC/Protocol.pm »