[Catalyst] How to pass vars to modules

RA Jones ra.jones at dpw.clara.co.uk
Thu Apr 26 20:55:59 GMT 2007


Dave Rolsky wrote:
> On Thu, 26 Apr 2007, RA Jones wrote:
> 
>> So I'm declaring it in all my controllers that need to do sorts, which 
>> is repetitive and probably not the best way to do it. Is there a 
>> standard way of handling modules like this (Date::Calc is another)?
> 
> I'd say that declaring it where it is used _is_ the best way to do it.
> 
> It doesn't hurt to declare what prereqs a module has at the top of a 
> module, and it'll make it clearer what it's using. This is doubly true 
> when you're importing functions into a new namespace. It's really 
> annoying to see some random function used in a module and then try to 
> figure out where it might've come from.

OK, thanks I can see the merit in that. But on the other hand is it 
really a good idea to put the same 'use' statement so many times in what 
could amount to 20 or more controllers? Is there a start-up penalty if I 
have to load multiple modules in each controller separately instead of 
once each in MyApp.pm?
-- 
Richard Jones
Leeds, UK



More information about the Catalyst mailing list