Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Difference between 'use' and 'require'

by rrwo (Friar)
on Dec 07, 2004 at 20:29 UTC ( #412995=note: print w/replies, xml ) Need Help??


in reply to Difference between 'use' and 'require'

Don't forget the arcane 'unimport' routine that is called when you use 'no' instead of 'use'.

It's good for making subroutines and constants have no-op or undefined values, so that code which calls the module doesn't have to worry about breaking in strict mode.

This only works for modules that have an unimport subroutine defined, though.

Carp::Asset is a good example:

no Carp::Assert; # change to use to enable assert( 0 ), if DEBUG;

Replies are listed 'Best First'.
Re^2: Difference between 'use' and 'require'
by Anonymous Monk on Apr 23, 2014 at 09:12 UTC
    Use excepts module name only. but require excepts whole filename.
      Do you mean "accepts" as in "takes" or "excepts" as in "creates an exception for"?
        Read the docs for use and require and you'll figure it out ; or simply ignore that post as its wrong.

      Use excepts module name only. but require excepts whole filename.

      Sure it doesn't "require excepts" such a thing

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://412995]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (3)
As of 2023-10-03 03:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?