in reply to Private namespace package question

count0 sounds correct in that this was probably done to avoid retyping a lot of use statements and that that this is not a good thing. Let me elaborate.

  1. If a script doesn't need a module, it's loaded anyway. No need for that overhead.
  2. It obscures what module you're script is actually using. When you see something like $foo->annihilate;, you probably would like to know what's being annihilated.
  3. What if you need, for one of your programs, to switch CGI for CGI::Lite? Oops! If you include CGI::Lite in the actual program, it's still loading CGI. If you include CGI::Lite in Private.pm, all of your programs needlessly load both.

In short, while I understand why the original author did this, it takes away control with the only apparent benefit being saving a few keystrokes. You're already saving enough using Perl in the first place :)

Side note: I am kind of wondering about the "use strict" statement at the top. If all this module is doing is loading other modules, this is useless. "use strict" is lexically scoped, so if you use Private.pm;, you'll gain the benefits of the DBI module, but not of strict. Since strict doesn't have any use in the module, I'm kind of wondering why it's there (other than habit - though it will prevent something like "ues CGI").

Cheers,
Ovid

Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.