Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
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.

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

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

      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.

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 about the Monastery: (4)
As of 2022-08-13 05:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?