Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: USE or Require?

by hardburn (Abbot)
on Jul 23, 2003 at 15:52 UTC ( #277219=note: print w/replies, xml ) Need Help??


in reply to USE or Require?

I find that modules that export by default aren't a big deal as long as the sub names are descriptive and you keep your use statement tight to the code that needs it.

For instance, the Compress::Zlib module exports compress() and decompress() automatically. In a recent bit of code, I wrote something like this:

my $data = 'mumble'; use Compress::Zlib; my $compressed = compress($data);

It should be fairly obvious, without reading the Compress::Zlib docs, where compress() comes from.

I will concede the point that this is not always possible, and that you often have little control over the sub names of a module.

----
I wanted to explore how Perl's closures can be manipulated, and ended up creating an object system by accident.
-- Schemer

Note: All code is untested, unless otherwise stated

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (6)
As of 2022-01-24 20:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:












    Results (65 votes). Check out past polls.

    Notices?