[Catalyst] Where to put "use"

Erik Wasser erik.wasser at iquer.net
Wed Feb 18 11:06:56 GMT 2009


On Wednesday 18 February 2009, Dermot wrote:

> One of my controller is starting to use a lot of other modules like
> File::Find...etc but they are usually confined to one subroutine or
> method. It's most common to see all the use statements at the top of
> the package but I have seen instances where they are declared within
> the Sub block. Is there an advantage is declaring the use of modules,
> that are only used by a single subroutine,  in that subroutine?

For perl it doesn't matter where you put this definition.

Personaly I expect to find the 'use' at the top of the sources. Not in 
in middle of the file. At least I would expect it in a middle of a 
subroutine.

Just my 2 cents.

-- 
So long... Fuzz



More information about the Catalyst mailing list