Siebel::Srvrmgr::ListParser::OutputFactory - abstract factory class to create Siebel::Srvrmgr::ListParser::Output objects
use Siebel::Srvrmgr::ListParser::OutputFactory; my $output = Siebel::Srvrmgr::ListParser::OutputFactory->create( $type, { data_type => $type, raw_data => \@data, cmd_line => 'list something' } ); if (Siebel::Srvrmgr::ListParser::OutputFactory->can_create('weirdo')) ? print "can\n" : print "cannot\n";
This is an abstract factory class to create instances of subclass of Siebel::Srvrmgr::ListParser::Output superclass.
It has the mapping between the types parsed by Siebel::Srvrmgr::ListParser class to the respective class of output. See Siebel::Srvrmgr::ListParser::OutputFactory::table_mapping for the mapping between types and classes.
Siebel::Srvrmgr::ListParser::OutputFactory::table_mapping
All methods below are class methods.
Returns the instance of the class defined by the type given as parameter. Expects two parameters: an string with the type of output and an hash reference with the parameters expected by the new method of Siebel::Srvrmgr::ListParser::Output subclasses.
new
A third, optional parameter, is required if the desired instance is a subclass of Siebel::Srvrmgr::ListParser::Output::Tabular: one must pass a single character as the field separator, if exists in the output to be parsed.
Despite using MooseX::AbstractFactory to implement the Abstract Factory pattern, this method must be invoked instead of create so the class will be able to make additional checkings necessary to define defaults for subclasses of Siebel::Srvrmgr::ListParser::Output::Tabular.
create
Expects a string as the output type.
Returns true if there is a mapping between the given type and a subclass of Siebel::Srvrmgr::ListParser::Output; otherwise it returns false;
Returns an hash reference with the mapping between the parsed types and subclasses of Siebel::Srvrmgr::ListParser::Ouput.
The values are array references with the partial classes names and a compiled regular expression to validate the command.
MooseX::AbstractFactory
Siebel::Srvrmgr::ListParser::Output
Siebel::Srvrmgr::ListParser
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.