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::Daemon::Condition



Annotate this POD


View/Report Bugs
Module Version: 0.29   Source  


Siebel::Srvrmgr::Daemon::Condition - object that checks which conditions should keep a Siebel::Srvrmgr::Daemon running


    my $condition = Siebel::Srvrmgr::Daemon::Condition->new(
                        total_commands => 10


Siebel::Srvrmgr::Daemon::Condition class has one function: define if the Siebel::Srvrmgr::Daemon object instance should continue it's loop execution or stop.

There are several checkings that are carried (for example, if the loop must be infinite or if the stack of commands is finished) and the object of this class will return true (1) or false (0) depending on the context.

Since this class was used exclusively to control de loop of execution, it does not make much sense to use it outside of Siebel::Srvrmgr::Daemon class.

There are more status that this class will keep, please check the attributes and methods.



Maximum command index. This is an integer attribute that identifies the last command from the commands stack (of Siebel::Srvrmgr::Daemon).

It's automatically set to total_commands - 1 right after object creation.


This is an integer that tells the total amount of commands available for execution. This class will keep track of the executed commands and the result of it will be part of the definition of the result returned from the method check and restart, if necessary, the stack of commands to be executed.

This attribute is required during object creation.


An integer that keeps tracking of the current command being executed, always starting from zero.

This attribute has a default value of zero.


An boolean that identifies if the last executed command output was used or not.


An boolean that identifies if the current command to be executed was truly submitted to srvrmgr program or not.



Returns the content of the attribute cmd_counter as an integer.


Returns a true or false based on the content of output_used attribute.


Sets the output_used attribute. Expects a 1 (true) or 0 (false) value as parameter.

If the parameter is true then the attribute cmd_sent will be set to false (a new command will need to be submitted).


Returns a true or false based on the content of cmd_sent attribute.


Sets the attribute cmd_sent. Expects true (1) or false (0) as value.


Returns an integer based on the content of max_cmd_idx attribute.


This method subtracts one from the total_cmd attribute.


This method will check various conditions and depending on them will return true (1) or false (0).

The conditions that are taken in consideration:


Increments by one the cmd_counter attribute, if possible.

It will check if the cmd_counter after incrementing will not pass the max_cmd_idx attribute. In this case, the method will not change cmd_counter value and will raise an exception.


This method checks if the cmd_counter can be increment or not, returning true (1) or false (0) depending on the conditions evaluated.


This method returns true (1) if the cmd_counter holds the last command index from the command stack, otherwise it returns false.


Resets the cmd_counter attributing setting it to zero. This is useful specially if the loop of execution is infinite (thus the command stack must be restarted).


This class is becoming more and more complex due the several conditions that need to be evaluated for defining if the Siebel::Srvrmgr::Daemon should still execute the run method or not. This probably should be replaced by a state machine.



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: