Handel::Checkout::Stash - Basic storage for checkout plugins during processing
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'}; ... };
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.
process
clear
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 });
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.
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.
Christopher H. Laco CPAN ID: CLACO claco@chrislaco.com http://today.icantfocus.com/blog/
To install Handel, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Handel
CPAN shell
perl -MCPAN -e shell install Handel
For more information on module installation, please visit the detailed CPAN module installation guide.