Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
I recall that once I've seen somewhere description of one undocumented(?) Perl feature which allows to do wierd things like loading Perl modules with use from, say, ZIP archive.

It is possible to put reference on subroutine in @INC and this subroutine will be called when Perl module is used (or required). This subroutine could implement loading of Perl modules from ZIP archive for example. Unfortunately I could not find description what interface should have such subroutine. That is what arguments are passed to it, what should this subroutine return, etc.

To prove that I'm not dreaming I wrote simple test script:

BEGIN { unshift @INC, sub { print "@_\n"; return }; } use Cwd;
It does print something which proves that subroutine reference in @INC does have some special meaning:
CODE(0x8116490) Cwd.pm CODE(0x8116490) strict.pm CODE(0x8116490) Carp.pm CODE(0x8116490) Exporter.pm CODE(0x8116490) base.pm CODE(0x8116490) warnings.pm
Does anybody have more info about it?

--
Ilya Martynov (http://martynov.org/)


In reply to Subroutine reference in @INC by IlyaM

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, 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, 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.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and all is quiet...

    How do I use this? | Other CB clients
    Other Users?
    Others browsing the Monastery: (4)
    As of 2018-07-21 00:32 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?
      It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?















      Results (442 votes). Check out past polls.

      Notices?