Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: USE or Require?

by hardburn (Abbot)
on Jul 23, 2003 at 15:52 UTC ( [id://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?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (4)
As of 2024-04-26 00:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found