File Coverage

blib/lib/Siebel/Srvrmgr/Daemon/Command.pm
Criterion Covered Total %
statement 9 9 100.0
branch n/a
condition n/a
subroutine 3 3 100.0
pod n/a
total 12 12 100.0


line stmt bran cond sub pod time code
1             package Siebel::Srvrmgr::Daemon::Command;
2              
3             =pod
4              
5             =head1 NAME
6              
7             Siebel::Srvrmgr::Daemon::Command - daemon command class
8              
9             =head1 SYNOPSIS
10              
11             my $action = Siebel::Srvrmgr::Daemon::Command->new(
12             {
13             command => 'list comps',
14             action => 'Siebel::Srvrmgr::Daemon::Action',
15             params => ['parameter1', 'parameter2']
16             }
17             );
18              
19              
20             =head1 DESCRIPTION
21              
22             This class represents a single command that will be executed by a L<Siebel::Srvrmgr::Daemon> instance.
23              
24             A command in this context is made of a srvrmgr command, an action to be executed after the commands output is received (the name of a subclass of
25             L<Siebel::Srvrmgr::Daemon::Action>) and an optional parameter in the form of an array reference for the action class being used.
26              
27             =cut
28              
29 6     6   8137 use Moose;
  6         347288  
  6         50  
30 6     6   42959 use MooseX::FollowPBP;
  6         54115  
  6         28  
31 6     6   49933 use namespace::autoclean;
  6         8362  
  6         63  
32              
33             =pod
34              
35             =head1 ATTRIBUTES
36              
37             All attributes are read-only and cannot be modified after a class instance is created.
38              
39             =head2 command
40              
41             The command attribute holds a string that will be submitted to the srvrmgr program. Beware that any string is acceptable but any correct output expected
42             depends on passing valid commands to the srvrmgr prompt. This attribute is required.
43              
44             =cut
45              
46             has command => ( isa => 'Str', is => 'ro', required => 1 );
47              
48             =pod
49              
50             =head2 action
51              
52             The action parameter expects a string with the name of a subclass of L<Siebel::Srvrmgr::Daemon::Action> class. If one is used, then only the name of the subclass can be
53             used (for example, 'Foobar' will produce an instance of a 'Siebel::Srvrmgr::Daemon::Action' subclass, if it exists). If another class is used, then the complete name
54             of the class must be used.
55              
56             Beware that the class passed as parameter must be able to deal with the srvrmgr output and do something with it.
57              
58             This attribute is obligatory.
59              
60             =cut
61              
62             has action => ( isa => 'Str', is => 'ro', required => 1 );
63              
64             =pod
65              
66             =head2 params
67              
68             The params parameter expects an array reference with any arbitrary number of parameters to the used by the subclass of L<Siebel::Srvrmgr::Daemon::Action> given as value for
69             the action parameter.
70              
71             Since this parameter is optional, if some value is passed by a subclass that does not expects a parameter, nothing will be processed.
72              
73             =cut
74              
75             has params =>
76             ( isa => 'ArrayRef', is => 'ro', required => 0, default => sub { [] } );
77              
78             =pod
79              
80             =head1 METHODS
81              
82             All methods available is for retrieving the parameters values by using the methodology proposed by L<MooseX::FollowPBP>. Use "get_<attribute>" to retrieve the desired
83             value.
84              
85             =cut
86              
87             =pod
88              
89             =head1 SEE ALSO
90              
91             =over
92              
93             =item *
94              
95             L<Siebel::Srvrmgr::Daemon::Action>
96              
97             =item *
98              
99             L<MooseX::FollowPBP>
100              
101             =item *
102              
103             L<Siebel::Srvrmgr::Daemon> command attribute description.
104              
105             =back
106              
107             =head1 AUTHOR
108              
109             Alceu Rodrigues de Freitas Junior, E<lt>arfreitas@cpan.orgE<gt>.
110              
111             =head1 COPYRIGHT AND LICENSE
112              
113             This software is copyright (c) 2012 of Alceu Rodrigues de Freitas Junior, E<lt>arfreitas@cpan.orgE<gt>.
114              
115             This file is part of Siebel Monitoring Tools.
116              
117             Siebel Monitoring Tools is free software: you can redistribute it and/or modify
118             it under the terms of the GNU General Public License as published by
119             the Free Software Foundation, either version 3 of the License, or
120             (at your option) any later version.
121              
122             Siebel Monitoring Tools is distributed in the hope that it will be useful,
123             but WITHOUT ANY WARRANTY; without even the implied warranty of
124             MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
125             GNU General Public License for more details.
126              
127             You should have received a copy of the GNU General Public License
128             along with Siebel Monitoring Tools. If not, see L<http://www.gnu.org/licenses/>.
129              
130             =cut
131              
132             __PACKAGE__->meta->make_immutable;
133             1;