[Catalyst] How to pass vars to modules

Dave Rolsky autarch at urth.org
Thu Apr 26 21:51:12 GMT 2007


On Thu, 26 Apr 2007, John Napiorkowski wrote:

> Another way to help with this is to create a custom controller that 
> declares the needed modules and have each controller that needs it 
> inherit.  Or if you'd rather not use inheritance you can play with Moose 
> and Roles.  I'm finding that Moose plays really nicely with Catalyst.

That's a different thing entirely.

The original post asked about things like loading modules which export 
functions. That has nothing to do with your controller, and asking 
Catalyst to load such modules via "use Catalst qw( +Some::Module )" is 
pretty gross.

Or maybe you're suggesting using inheritance to facilitate re-exporting 
these methods? Ingy's Spiffy module does that, and in my experience it's a 
horrible idea. Yes, it saves you some typing, but it's big hassle for 
maintenance. It's just another version of action at a distance.

If you want to share behavior amongst your controller classes, then yes, 
creating a single parent controller they all inherit from makes sense.


-dave

/*===================================================
VegGuide.Org                        www.BookIRead.com
Your guide to all that's veg.       My book blog
===================================================*/



More information about the Catalyst mailing list