develooper Front page | perl.perl5.porters | Postings from May 2003

Re: [perl #8860] [not RESOLVED] .pmc extension not documented in require

Thread Previous | Thread Next
Casey West
May 9, 2003 13:18
Re: [perl #8860] [not RESOLVED] .pmc extension not documented in require
Message ID:
It was Friday, May 09, 2003 when David Dyck took the soap box, saying:
: This really isn't resolved, as
:  perldoc -f require states
:                If EXPR is a bareword, the require assumes a ".pm"
:                extension and replaces "::" with "/" in the
:                filename for you, to make it easy to load standard
:                modules.  This form of loading of modules does not
:                risk altering your namespace.
: but it doesn't mention .pmc.

Now it does, see patch below.

  Casey West

"DOS addresses only 1 Megabyte of RAM because we cannot imagine any
applications needing more."
 -- Microsoft, 1980, on the development of DOS

--- perl-current.orig/pod/perlfunc.pod  Fri May  9 00:58:19 2003
+++ perl-current/pod/perlfunc.pod       Fri May  9 16:16:56 2003
@@ -4056,6 +4056,15 @@
         eval "require $class";
+Now that you understand how C<require> looks for files in the case of
+a bareword argument, there is a little extra functionality going on
+behind the scenes.  Before C<require> looks for a "F<.pm>" extension,
+it will first look for a filename with a "F<.pmc>" extension.  A file
+with this extension is assumed to be Perl bytecode generated by
+L<B::ByteCode|B::ByteCode>.  If this file is found, and it's modification
+time is newer than a coinciding "F<.pm>" non-compiled file, it will be
+loaded in place of that non-compiled file ending in a "F<.pm>" extension.
 You can also insert hooks into the import facility, by putting directly
 Perl code into the @INC array.  There are three forms of hooks: subroutine
 references, array references and blessed objects.

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About