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   3500 use Moose 2.0401;
  6         124  
  6         45  
30 6     6   38103 use MooseX::FollowPBP 0.05;
  6         39593  
  6         41  
31 6     6   45437 use namespace::autoclean 0.13;
  6         137  
  6         67  
32             our $VERSION = '0.29'; # VERSION
33              
34             =pod
35              
36             =head1 ATTRIBUTES
37              
38             All attributes are read-only and cannot be modified after a class instance is created.
39              
40             =head2 command
41              
42             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
43             depends on passing valid commands to the srvrmgr prompt. This attribute is required.
44              
45             =cut
46              
47             has command => ( isa => 'Str', is => 'ro', required => 1 );
48              
49             =pod
50              
51             =head2 action
52              
53             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
54             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
55             of the class must be used.
56              
57             Beware that the class passed as parameter must be able to deal with the srvrmgr output and do something with it.
58              
59             This attribute is obligatory.
60              
61             =cut
62              
63             has action => ( isa => 'Str', is => 'ro', required => 1 );
64              
65             =pod
66              
67             =head2 params
68              
69             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
70             the action parameter.
71              
72             Since this parameter is optional, if some value is passed by a subclass that does not expects a parameter, nothing will be processed.
73              
74             =cut
75              
76             has params =>
77             ( isa => 'ArrayRef', is => 'ro', required => 0, default => sub { [] } );
78              
79             =pod
80              
81             =head1 METHODS
82              
83             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
84             value.
85              
86             =cut
87              
88             =pod
89              
90             =head1 SEE ALSO
91              
92             =over
93              
94             =item *
95              
96             L<Siebel::Srvrmgr::Daemon::Action>
97              
98             =item *
99              
100             L<MooseX::FollowPBP>
101              
102             =item *
103              
104             L<Siebel::Srvrmgr::Daemon> command attribute description.
105              
106             =back
107              
108             =head1 AUTHOR
109              
110             Alceu Rodrigues de Freitas Junior, E<lt>arfreitas@cpan.orgE<gt>.
111              
112             =head1 COPYRIGHT AND LICENSE
113              
114             This software is copyright (c) 2012 of Alceu Rodrigues de Freitas Junior, E<lt>arfreitas@cpan.orgE<gt>.
115              
116             This file is part of Siebel Monitoring Tools.
117              
118             Siebel Monitoring Tools is free software: you can redistribute it and/or modify
119             it under the terms of the GNU General Public License as published by
120             the Free Software Foundation, either version 3 of the License, or
121             (at your option) any later version.
122              
123             Siebel Monitoring Tools is distributed in the hope that it will be useful,
124             but WITHOUT ANY WARRANTY; without even the implied warranty of
125             MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
126             GNU General Public License for more details.
127              
128             You should have received a copy of the GNU General Public License
129             along with Siebel Monitoring Tools. If not, see L<http://www.gnu.org/licenses/>.
130              
131             =cut
132              
133             __PACKAGE__->meta->make_immutable;
134             1;