NAME
Handel::Checkout::Plugin - Base module for Handle::Checkout plugins
SYNOPSIS
package MyPackage::FaxOrder;
use Handel::Constants qw(:checkout);
use base 'Handel::Checkout::Plugin';
sub register {
my ($self, $ctx) = @_;
$ctx->add_handler(CHECKOUT_PHASE_DELIVER, \&deliver);
};
sub deliver {
my ($self, $ctx) = @_;
...
return CHECKOUT_HANDLER_OK;
};
DESCRIPTION
Handel::Checkout::Plugin
is the base module for all checkout pipeline plugins used in Handel::Checkout
.
CONSTRUCTOR
new
Returns as new Handle::Checkout::Plugin object. This method is inherited by all subclasses and called when each plugin is loaded into the checkout pipeline. There should be no need to call this method directly.
METHODS
The following methods are called during various times in the checkout process. Each method receives a reference to its instance as well as reference to the current checkout process:
sub init {
my ($self, $ctx) = @_;
};
init
This method is called then the plugin is first created and loaded into the checkout pipeline. While a pipeline can be processed more than once, init will only be called the first time the plugin is loaded.
register
After a plugin is loaded, register
is called so the plugin can register itself with the various phases in the current checkout pipeline process using add_handler
in Handel::Checkout
:
sub register {
my ($self, $ctx) = @_;
$ctx->add_handler(CHECKOUT_PHASE_DELIVER, \&deliver);
};
A plugin can register any number of methods with any number of phases.
setup
Each time a checkout pipeline is processed, the setup
method is called on all registered plugins to allow each plugin to perform any necessary preparation before its registered handler subs are called.
teardown
Each time a checkout pipeline is finished being processed, the teardown
method is called on all registered plugins to allow each plugin to perform any cleanup it may need to do.
name
Returns the name of the current instance.
SEE ALSO
Handel::Checkout, Handel::Constants
AUTHOR
Christopher H. Laco
CPAN ID: CLACO
claco@chrislaco.com
http://today.icantfocus.com/blog/