[Catalyst] How to pass vars to modules

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


On Thu, 26 Apr 2007, RA Jones wrote:

> 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?

Yes, it _really_ is a good idea. I'm going to write an essay/rant on what 
being a professional developer means in my use perl journal soon, and part 
of that will talk about how the audience for code that you write is the 
next developer. This is writing code for the next developer.

There's very little penalty to pay. The Perl interpreter only loads a 
module once, so multiple use statements for the same module just involve 
checking to see if its already loaded. Premature optimization is the root 
of all evil, and this would be beyond premature.


-dave

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



More information about the Catalyst mailing list