http://qs321.pair.com?node_id=277219


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