plugins; was Re: [Catalyst] debug mode

Matt S Trout dbix-class at trout.me.uk
Tue Jun 5 20:33:36 GMT 2007


On Tue, Jun 05, 2007 at 08:04:03AM -0700, mreece at vinq.com wrote:
> if the catalyst base controller class provided an easy way to access $c
> from a utility method (vs an action method, which receives $c
> 'automatically'), then i think plugins might be a little less popular.

Well, you can already do $self->_app to get the application.

> still, depending on frame of reference, i've moved/developed some things
> to/as base controllers, and it has helped to have something like this in
> my Base::Controller, but maybe it should come for free?
> 
>   __PACKAGE__->mk_accessors('_context');
> 
>   sub _ACTION : Pricvate {
>     my ($self, $c) = @_;
>     $self->_context($c);
>     $self->SUPER::_ACTION($c);
>   }

That's not only in the wrong place to work for begin/end/auto it screws up
the destruction process and is therefore really really dangerous.

http://search.cpan.org/~jrockway/Catalyst-Component-ACCEPT_CONTEXT-0.02/lib/Catalyst/Component/ACCEPT_CONTEXT.pm

is an already extant, non-buggy version.

Don't Reinvent The Wheel :)

-- 
      Matt S Trout       Need help with your Catalyst or DBIx::Class project?
   Technical Director    Want a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/             http://www.shadowcatsystems.co.uk/ 



More information about the Catalyst mailing list