1. If module A uses something from module B, then there OUGHT TO BE use B; inside A.pm. Fullstop. Modules should not expect someone else to load their dependencies for them. There is no need to "optimize" and use a module just one. Perl is clever enough to notice the module had already been loaded and it doesn't load it twice.
    The second time Perl only calls the module's import() subroutine to allow it to export the default list of functions into the calling namespace.
  2. You are NOT supposed to run modules directly. Very few modules support that and likely even fewer should.
  3. Modules and namespaces are related, but they are NOT the same thing. You can have several namespaces right inside your a.pl script and define the myModule2:authorize right there. It's actually quite common for modules to contain several namespaces. One of them SHOULD match the name of the file, but there's often several others inside.

Jenda
1984 was supposed to be a warning,
not a manual!


In reply to Re: Perl doesn't give error when module is not found 2 by Jenda
in thread Perl doesn't give error when module is not found 2 by Anonymous Monk

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.