Siebel::Srvrmgr::Daemon::Action - base class for Siebel::Srvrmgr::Daemon action
This class must be subclassed and the do method overrided.
do
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.
return
A reference to a Siebel::Srvrmgr::ListParser object. This attribute is required during object creation and is read-only.
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 to who is creating subclasses of Siebel::Srvrmgr::Daemon::Action.
params
This attribute is read-only.
A string telling the expected output type the Siebel::Srvrmgr::Daemon::Action subclass expectes to find. This is a lazy attribute since each subclass may have a different type of expected output.
The string must be the name of a subclass of Siebel::Srvrmgr::ListParser::Output and it will be used for validation during execution of do_parsed method.
do_parsed
Returns the Siebel::Srvrmgr::ListParser object stored into the parser attribute.
parser
Returns the array reference stored in the params attribute.
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).
This method does:
get_parser
clear_parsed_tree
This method must be overrided by subclasses or it will die with trace.
die
It expects an array reference with the parsed tree given by get_parsed_tree of a Siebel::Srvrmgr::ListParser instance.
get_parsed_tree
This method is invoked internally by do method, but is also usable directly if the parsed tree is given as expected.
If the output is used, this method must returns true, otherwise false.
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.
Moose
Moose::Manual::MethodModifiers
Siebel::Srvrmgr::ListParser
Siebel::Srvrmgr::Daemon
Siebel::Srvrmgr::ListParser::Output
Alceu Rodrigues de Freitas Junior, <arfreitas@cpan.org>
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/>.
To install Siebel::Srvrmgr, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Siebel::Srvrmgr
CPAN shell
perl -MCPAN -e shell install Siebel::Srvrmgr
For more information on module installation, please visit the detailed CPAN module installation guide.