NAME

Siebel::Srvrmgr::Daemon::Action - base class for Siebel::Srvrmgr::Daemon action

SYNOPSIS

This class must be subclassed and the do method overloaded.

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