Beefy Boxes and Bandwidth Generously Provided by pair Networks Bob
Do you know where your variables are?
 
PerlMonks  

Re^2: Using "USE" instead of "DO" for subroutines call in external file

by Anonymous Monk
on May 27, 2005 at 11:48 UTC ( [id://461117]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to Re: Using "USE" instead of "DO" for subroutines call in external file
in thread Using "USE" instead of "DO" for subroutines call in external file

Mr Tucano,
use the module only when you really need it
Thanks for the reply.
But how do I know I really need it? i.e. with *use*
Also having read,pointer by Mr,Displeaser below. Do I need to put all that bell and whistles? (e.g. ISA,etc)
  • Comment on Re^2: Using "USE" instead of "DO" for subroutines call in external file

Replies are listed 'Best First'.
Re^3: Using "USE" instead of "DO" for subroutines call in external file
by tucano (Scribe) on May 31, 2005 at 09:05 UTC
    From O'reilly Perl Cookbook:

    Problem
    You have a module that you don't need to load each time the program runs, or whose inclusion you wish to delay until after the program starts up.

    A related situation arises in programs that don't always use the same set of modules every time they're run. For example, the factors program from Chapter 2, Numbers, needs the infinite precision arithmetic library only when the -b command-line flag is supplied. A use statement would be pointless within a conditional because it's evaluated at compile time, long before the if can be checked. So we'll use a require instead:
    if ($opt_b) { require Math::BigInt; }

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://461117]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.