I was aware of the INC object. Well, just because to be sure every now and again I check perldoc -f require, although in fact I usually stick with the "sub form of code-in-@INC". Now, indeed this kind of hackery is there for doing stuff like "extracting from tarball" (or retrieving over a network connection, maybe). In this case, if I "only" want to change a filename, or a relative path (e.g. Foo/*.pm to Foo-devel/*.pm) as shown in my previous example, then I may search regular @INC directories for the real file I want and return an open file handle to it. But that would amount to reinventing the wheel. And it wouldn't chain with other code in @INC. I may just want perl to do that for me instead...

Indeed agree that some care should be payed to a fallback mechanism and to informative error messages. But modulo these caveats, after all this is a somewhat advanced hackery and fundamentally adding the feature would amount to... removing a feature, precisely the one that makes the passed path read-only, so...


In reply to Re^4: RFC: feature proposal re code in @INC by blazar
in thread RFC: feature proposal re code in @INC by blazar

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.