[Catalyst] plugins; was Re: debug mode

Matt S Trout dbix-class at trout.me.uk
Thu Jun 7 22:12:30 GMT 2007

On Thu, Jun 07, 2007 at 01:04:02PM -0700, mla wrote:
> Matt S Trout wrote:
> >On Thu, Jun 07, 2007 at 03:55:16AM -0700, Jonathan Swartz wrote:
> >>mia wrote:
> >>>Matt S Trout wrote:
> >>>>On Wed, Jun 06, 2007 at 02:18:33PM -0700, mla wrote:
> >>>Assuming I'm not using threads, how would I hurt myself by
> >>>subclassing Catalyst and supplying a MyApp->context that returns
> >>>the current catalyst context?
> >>Yes, I'd like to know more about this too please. Mason has a similar  
> >>construct - HTML::Mason::Request->instance() - and it works fine with  
> >>Mason subrequests or recursive calls to an entirely different Mason  
> >>interpreter. It just returns the value of a dynamically scoped  
> >>variable that is set at the beginning of a Mason request.
> >
> >If you like that style, load Catalyst::Plugin::Singleton and enjoy. I don't
> >but I'm not the arbiter of bad code :)
> Cool, that's exactly what I was hoping for.
> Other than the fact you don't like the style, why is it bad?
> You don't like singletons?

I'm not fond of any magic global if I can possibly avoid it - I find it
tends to encourage tight coupling of code and action at a distance and
makes testing and debugging messy.

I prefer anything a method call needs to have been either (a) passed to the
object when it was constructed or (b) passed to the method as it's called.

It can be a bit more work up-front but it makes you think about your
architecture, which I find pays off down the road.

      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