View on
MetaCPAN is shutting down
For details read Perl NOC. After June 25th this page will redirect to
Alceu Rodrigues de Freitas Junior > Siebel-Srvrmgr > Siebel::Srvrmgr::ListParser



Annotate this POD


View/Report Bugs
Module Version: 0.29   Source  


Siebel::Srvrmgr::ListParser - state model parser to idenfity which output type was read


    use Siebel::Srvrmgr::ListParser;
    my $parser = Siebel::Srvrmgr::ListParser->new({ prompt_regex => $some_prompt });


Siebel::Srvrmgr::ListParser is a state machine parser created to parse output of "list" commands executed through srvrmgr program.

The parser can identify different types of commands and their outputs from a buffer given as parameter to the module. For each type of output identified an Siebel::Srvrmgr::ListParser::Buffer object will be created, identifying which type of command was executed and the raw information from it.

At the end of information read from the buffer, this class will call Siebel::Srvrmgr::ListParser::OutputFactory to create specific Siebel::Srvrmgr::ListParser::Output objects based on the identified type of Buffer object. Each of this objects will parse the raw output and populate attributes based on this information. After this is easier to obtain the information from those subclasses of Siebel::Srvrmgr::ListParser::Output.

Siebel::Srvrmgr::ListParser expects to receive output from srvrmgr program in an specific format and is able to idenfity a limited number of commands and their outputs, raising an exception when those types cannot be identified. See subclasses of Siebel::Srvrmgr::ListParser::Output to see which classes/types are available.

Logging of this class can be enabled by using Siebel::Srvrmgr logging feature.


Currently, this class can parse the output of the following Siebel Server Manager commands:

Also the initial text after connecting to Server Manager can be parsed.



An array reference of parsed data. Each index should be a reference to another data extructure, most probably an hash reference, with parsed data related from one line read from output of srvrmgr program.

This is an read-only attribute.


A boolean value that identifies if the ListParser object has a parsed tree or not.


A string with the last command identified by the parser. It is used for several things, including changes in the state model machine.

This is a read-only attribute.


A boolean value that identified when the last_command attribute has been changed (i.e another command was identified by the parser).


An array reference with each one of the indexes being a Siebel::Srvrmgr::ListParser::Buffer object.


A reference to a Siebel::Srvrmgr::ListParser::Output::Greetings. It is defined during initial parsing (can be available or not).

This object has some details about the enterprise connected. Check the related Pod for more information.





Sets the boolean attribute with the same name. If no parameter is given, returns the value stored in the is_cmd_changed attribute. If a parameter is given, expects to received true (1) or false (0), otherwise it will return an exception.


Returns the parsed_tree attribute.


Returns the regular expression reference from the prompt_regex attribute.


Sets the prompt_regex attribute. Expects an regular expression reference as parameter.


Returns the regular expression reference from the hello_regex attribute.


Sets the hello_regex attribute. Expects an regular expression reference as parameter.


Returns an string of the last command read by the parser.


Returns a boolean value (1 for true, 0 for false) if the parser has or not a parsed tree.


Set the last command found in the parser received data. It also triggers that the command has changed (see method is_cmd_changed).


Automatically defines the state machine object based on Siebel::Srvrmgr::ListParser::FSA.


Sets the buffer attribute, inserting new Siebel::Srvrmgr::ListParser::Buffer objects into the array reference as necessary.

Expects an instance of a FSA::State class as parameter (obligatory parameter).


Removes the array reference from the buffer attribute and associates a new one with an empty array. This should be used for cleanup purpouses or attemp to free memory.


Returns an integer with the total number of objects available in the parsed_tree attribute.


Removes the reference on parsed_tree attribute. Also, sets has_tree attribute to false.


Sets the parsed_tree attribute, adding references as necessary. Also sets the has_tree attribute to true.

This method should not be called directly unless you know what you're doing. See append_output method.


Appends an object to an existing parsed tree.

Can use an optional parameter as Siebel::Srvrmgr::ListParser::Buffer instance, othewise it will use the returned value from get_buffer method.

It uses Siebel::Srvrmgr::ListParser::OutputFactory to create the proper Siebel::Srvrmgr::ListParser::Output object based on the Siebel::Srvrmgr::ListParser::Buffer type.

If the item received as parameter is a Siebel::Srvrmgr::ListParser::Output::Greetings instance, it will be assigned to the enterprise attribute instead of being added to the parsed_tree attribute.


Parses one or more commands output executed through srvrmgr program.

Expects as parameter an array reference with the output of srvrmgr, including the command executed. The array references indexes values should be rid off any EOL character.

It will create an FSA::Rules object to parse the given array reference, calling append_output method for each Siebel::Srvrmgr::ListParser::Buffer object found.

This method will raise an exception if a given output cannot be identified by the parser.


Due issues with memory leak and garbage collection, DEMOLISH was implemented to call additional methods from the API to clean buffer and parsed tree data.


Checkout the POD for the Siebel::Srvrmgr::ListParser::Output objects to see details about which kind of output is expected if you're getting errors from the parser. There are details regarding how the settings of srvrmgr are expect for output of list commands.



Alceu Rodrigues de Freitas Junior, <<>


This software is copyright (c) 2012 of Alceu Rodrigues de Freitas Junior, <>

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 <>.

syntax highlighting: