http://www.perlmonks.org?node_id=153428

IlyaM has asked for the wisdom of the Perl Monks concerning the following question:

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/)