----- Original Message ----
From: Dave Rolsky <[EMAIL PROTECTED]>
To: The elegant MVC web framework <[email protected]>
Sent: Thursday, April 26, 2007 3:17:20 PM
Subject: Re: [Catalyst] How to pass vars to modules

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.

-dave

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.

--John




__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

_______________________________________________
List: [email protected]
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/

Reply via email to