View on
Alceu Rodrigues de Freitas Junior > Siebel-Srvrmgr > Siebel::Srvrmgr::Daemon::ActionStash



Annotate this POD


View/Report Bugs
Module Version: 0.29   Source  


Siebel::Srvrmgr::Daemon::ActionStash - singleton to stash data returned by Siebel::Srvrmgr::Daemon::Action subclasses


    package MyAction;
    use Moose;
    use namespace::autoclean;

    extends 'Siebel::Srvrmgr::Daemon::Action';

    my $stash = Siebel::Srvrmgr::Daemon::ActionStash->instance();
    $stash->set_stash([{foobar => foobar}, [qw(one two three)]]);

    package main;

    my $stash = Siebel::Srvrmgr::Daemon::ActionStash->instance();
    my $something = $stash->shift_stash()
    # do something with $something


This class was created to enable the possibility to retrieve data from an Siebel::Srvrmgr::Daemon::Action subclass invoked by Siebel::Srvrmg::Daemon without the need to return data from within the objects.

Since Siebel::Srvrmgr::Daemon::ActionStash is a singleton, a reference of the already instantied object will always be returned when calling instance. So, before calling the method run from a Siebel::Srvrmgr::Daemon class instance, it is just a matter to call instance and inside the Siebel::Srvrmgr::Daemon::Action subclass, call the initialize method with the data that should be returned as parameter.

The drawnback from this technique is that two Action objects cannot used the same Stash at the same time or data will be replace/lost: a ActionStash instance should be used exclusively by a single Action subclass. If you have need to returned data from several Siebel::Srvrmgr::Daemon::Action subclasses you must use a different method.

Considering this situation, the interface of this class should be considered experimental and may be changed in the future releases.



This attribute is a array reference of references. This means that it will accept any reference to some data structure that you think it will be useful (including objects).

If undefined, this attribute will returned an empty array reference.



Returns the stash attribute array reference.


Sets the stash attribute. Expects an array reference as parameter.

Beware that such call will complete remove all other data stored in the stash. To add single items, see push_stash method.


Expects as parameter a reference.

pushes a new reference into the stash attribute.

If there is no member in the stash attribute, the method set_stash will be invoked to set the attribute.


shifts the stash attribute, removing the first item in the attribute and returning it.

If there is not other member to be shift, it will return undef.


Retrieves all content from the stash attribute, clean it up and returns the content.

It is basically calling get_stash and set_stash with an empty array reference as parameter.


pops the stash attribute, returning the last element.



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: