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(); # do something with the get_stash method
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.
instance
run
initialize
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.
stash
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.
push_stash
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.
set_stash
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.
Siebel::Srvrmgr::Daemon::Action
MooseX::Singleton
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.