Suppose you want to grab a different version of just one function. Say, you've updated code and now want to call a newer thing, but have not updated the entire file yet.

use Module v1.0 qw/foo bar/; use Module v2.0 qw/baz/; # was not present in 1.0
That looks easy enough, and should work just fine. But, recall the handling of direct module calls, as opposed to calling through the imported hard link. If you write Module::foo it will decide at run-time that it must mean foo v1.0 based on the caller.

So, what happens if you call Module::zippo, something that was not directly imported also? Should that assume v1.0 or v2.0?

Musings:

However, I'd prefer to avoid the problem and not have the issue come up. E.g. some way to spot-import by version without making the user wonder what happens to the caller's "in use" setting.

For example, use a general syntax for renaming the import and specifying which version you want, and not re-specify a indirect version argument:

use Module v1.0 qw/foo bar/; use Module --rename => [\&baz, 'baz', v2.0];
Any ideas?

—John


In reply to How should this work ? (design of Exporter::VA) by John M. Dlugosz

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.