in reply to Is it ok to require a module in a sub or method?

Bearing in mind the caveats noted by ikegami, you can also use autouse the module at the top of your program, to defer the loading of the module until if and when it is called.

This means that your program doesn't need the make-work "should I load the module before I use it?" code. There are also the AnyLoader and AutoLoader modules which do roughly the same thing, but I am less familiar with them.

• another intruder with the mooring in the heart of the Perl

  • Comment on Re: Is it ok to require a module in a sub or method?