NAME
Handel::Checkout::Stash - Basic storage for checkout plugins during processing
SYNOPSIS
use Handel::Checkout;
my $checkout = Handel::Checkout->new;
$checkout->process;
# later in some plugin
sub myhandler {
my ($self, $ctx) = @_;
$ctx->stash->{'mystuff'};
...
};
# later in some other plugin
sub myhandler {
my ($self, $ctx) = @_;
my $stuff = $ctx->stash->{'mystuff'};
...
};
DESCRIPTION
Handel::Checkout::Stash is used by Handel::Checkout::Plugin plugins to pass data between themselves during a call to process
. Before and after each call to process, clear
is called is empty the stash.
To prevent this behavior, simply subclass this package with an empty clear and tell Handel::Checkout to use the new stash instead:
package MyApp::Stash;
use strict;
use warnings;
use base 'Handel::Checkout::Stash';
sub clear {};
---
use Handel::Checkout;
my $co = Handel::Checkout->new({
stash => MyApp::Stash->new
});
CONSTRUCTOR
new
Creates a new instance of Handel::Checkout::Stash. You can optionally pass a hash reference to new which will be blessed into the new stash instance.
METHODS
clear
Empties the contents of the stash.
The method is called before the call to $plugin->setup so plugins can set stash data, and the stash remains until the next call to process so $plugin->teardown can read any remaining stash data before process
ends.
AUTHOR
Christopher H. Laco
CPAN ID: CLACO
claco@chrislaco.com
http://today.icantfocus.com/blog/