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

Download:
Siebel-Srvrmgr-0.14.tar.gz

Dependencies

Annotate this POD

Website

View/Report Bugs
Source  

NAME ^

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

SYNOPSIS ^

    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

DESCRIPTION ^

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.

ATTRIBUTES ^

stash

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.

METHODS ^

get_stash

Returns the stash attribute array reference.

set_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

Pushes a new reference into the stash attribute.

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

SEE ALSO ^

AUTHOR ^

Alceu Rodrigues de Freitas Junior, <arfreitas@cpan.org>.

COPYRIGHT AND LICENSE ^

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

syntax highlighting: