[Handel] plugin for checkout

Christopher H. Laco claco at chrislaco.com
Mon Aug 14 17:35:23 CEST 2006


Jan Gerene wrote:
> Op zaterdag 12 augustus 2006 22:42, schreef Christopher H. Laco:
>> We resolved this on IRC, but for the sake of the answer being here....
>>
>> Handel::Checkout loads plugins from Handel::Checkout::Plugin::*.
>> To load plugins from different namespaces, you must add them to the ENV
>> config variables, or during new:
>>
>>
>>   my $checkout >>     addpluginpaths => 'UniBooks::Plugin',
>>     order  => $order,
>>     phases => 'CHECKOUT_PHASE_VALIDATE'
>>   });
>>
>> -=Chis
> 
> This works fine, thx. 
> Is it possible to get to the catalyst context from within the plugin e.g. I 
> would like to use "$c->model('xxx')" and can't find how to do that.
> 
> Regards;

Well, if you're using Handel::Checkout directly within controller code
in Catalyst, you can at least do this:


package MyController;
sub foo : Local {
	my ($self, $c) 
	my $stash 	$stash->{'catalyst'} 
	my $checkout 	...
	$checkout->process;
};

...within the plugin....

package MyPlugin;
sub handler {
	my ($self, $ctx) 	my $catctx 	...
};


That brings up a minor little usability issue I'll try to fix.
To make it easier, I should allow one to pass stash options to Stash->new:

	my $stash 	    catalyt => $c
	});


and for that matter, Checkout->new 'stash' could just DTRT as well:

	my $checkout 		stash => {catalyst => $c}  # does Stash->new()
	});


-=Chris

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: OpenPGP digital signature
Url : http://lists.rawmode.org/pipermail/handel/attachments/20060814/a5de2a5e/attachment.pgp 


More information about the Handel mailing list