NAME
Siebel::Srvrmgr::Daemon::Action - base class for Siebel::Srvrmgr::Daemon action
SYNOPSIS
This class must be subclassed and the do
method overrided.
An subclass should return true ONLY when was able to identify the type of output received. Beware that the output expected must include also the command executed or the Siebel::Srvrmgr::ListParser object will not be able to identify the type of the output (Siebel::Srvrmgr::Daemon does that).
This can be accomplish using something like this in the do
method:
sub do {
my $self = shift;
my $buffer = shift;
$self->get_parser()->parse($buffer);
my $tree = $self->get_parser()->get_parsed_tree();
foreach my $obj ( @{$tree} ) {
if ( $obj->isa('Siebel::Srvrmgr::ListParser::Output::MyOutputSubclassName') ) {
my $data = $obj->get_data_parsed();
# do something
return 1;
}
} # end of foreach block
return 0;
}
Where MyOutputSubclassName is a subclass of Siebel::Srvrmgr::ListParser::Output.
If this kind of output is not identified and the proper return
given, Siebel::Srvrmgr::Daemon can enter in a infinite loop.
ATTRIBUTES
parser
A reference to a Siebel::Srvrmgr::ListParser object. This attribute is required during object creation and is read-only.
params
An array reference. params
is an optional attribute during the object creation and it is used to pass additional parameters. How those parameters are going to be used is left who is creating subclasses of Siebel::Srvrmgr::Daemon::Action.
This attribute is read-only.
METHODS
get_parser
Returns the Siebel::Srvrmgr::ListParser object stored into the parser
attribute.
get_params
Returns the array reference stored in the params
attribute.
do
This method expects to receive a array reference (with the content to be parsed) as parameter and it will do something with it. Usually this should be identify the type of output received, giving it to the proper parse and processing it somehow.
Every do
method must return true (1) if output was used, otherwise false (0);
Actually this method will only validate if the parameter is an array reference or not. Subclasses must override do
to actually to something with the array reference content (see override
method in Moose::Manual::MethodModifiers).
CAVEATS
This class may be changed to a role instead of a superclass in the future since it's methods could be used by different classes.
SEE ALSO
AUTHOR
Alceu Rodrigues de Freitas Junior, <arfreitas@cpan.org<>
COPYRIGHT AND LICENSE
This software is copyright (c) 2012 of Alceu Rodrigues de Freitas Junior, <arfreitas@cpan.org<>
This file is part of Siebel Monitoring Tools.
Siebel Monitoring Tools is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
Siebel Monitoring Tools is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with Siebel Monitoring Tools. If not, see <http://www.gnu.org/licenses/>.