File Coverage

blib/lib/Lim/Agent/CLI.pm
Criterion Covered Total %
statement 15 38 39.4
branch 0 4 0.0
condition n/a
subroutine 5 9 55.5
pod 2 2 100.0
total 22 53 41.5


line stmt bran cond sub pod time code
1             package Lim::Agent::CLI;
2              
3 1     1   42598 use common::sense;
  1         3  
  1         10  
4              
5 1     1   74 use Scalar::Util qw(weaken);
  1         2  
  1         78  
6              
7 1     1   6 use Lim ();
  1         2  
  1         20  
8 1     1   6 use Lim::Agent ();
  1         2  
  1         25  
9              
10 1     1   7 use base qw(Lim::Component::CLI);
  1         2  
  1         686  
11              
12             =encoding utf8
13              
14             =head1 NAME
15              
16             ...
17              
18             =head1 VERSION
19              
20             See L for version.
21              
22             =cut
23              
24             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     0 1   my ($self) = @_;
38 0           my $agent = Lim::Agent->Client;
39            
40 0           weaken($self);
41             $agent->ReadVersion(sub {
42 0     0     my ($call, $response) = @_;
43            
44 0 0         if ($call->Successful) {
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     0 1   my ($self) = @_;
61 0           my $agent = Lim::Agent->Client;
62            
63 0           weaken($self);
64             $agent->ReadPlugins(sub {
65 0     0     my ($call, $response) = @_;
66            
67 0 0         if ($call->Successful) {
68 0           $self->cli->println(join("\t", qw(Name Description Module Version)));
69 0           foreach my $plugin (@{$response->{plugin}}) {
  0            
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<< >>
84              
85             =head1 BUGS
86              
87             Please report any bugs or feature requests to L.
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
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; # End of Lim::Agent::CLI