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.


In reply to (Ovid) Re: Private namespace package question by Ovid
in thread Private namespace package question by apprentice

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.