Two other issues come into this. What is imported? What namespaces do we subclass?

An old style 'foo.pl' library by default exports everything it defines, so two requires may act as you fear, except that the last executed require provides the visible &todo. Perl modules are expected to establish their own namespace and not walk on each other's definitions.

In your example, something.pm may call itself package something; internally, so its &todo is addressed as &something::todo while the other is addressed as 'different::todo(@things). Calling require happens at runtime, so you may need to import the routines you want.

If you place the module namespace on your own namespace's @ISA at some time, you inherit whichever &todo appears first in a depth-first search of @ISA.

After Compline,
Zaxo


In reply to Re: Reloading modules more than once by Zaxo
in thread Reloading modules more than once by Ashcrow

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.