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

POD enhancement - sub INC { }

Thread Next
Sam Vilain
September 30, 2003 10:30
POD enhancement - sub INC { }
Message ID:
These two snippets should be the same:

package Foo;
sub INC{ print "Foo\n" };
package main; 
$x=bless {},Foo;

sub Foo::INC{ print "Foo\n" };
$x=bless {},Foo; 

Only the latter works.  I suggest adding this as a note to the section
in L<perlfunc/require>:

--- perl-5.8.1.orig/pod/perlfunc.pod    Wed Sep 17 13:48:53 2003
+++ perl-5.8.1/pod/perlfunc.pod Tue Sep 30 18:28:52 2003
@@ -4173,6 +4173,10 @@
 Note that these hooks are also permitted to set the %INC entry
 corresponding to the files they have loaded. See L<perlvar/%INC>.
+Also note the use of C<sub Foo::INC>, rather than just C<sub INC>;
+this is necessary due to the enchanted nature of *INC.  See
+L<perlvar/Technical Note on the Syntax of Variable Names> for more
 For a yet-more-powerful import facility, see L</use> and L<perlmod>.
Sam Vilain,

A seeming ignorance is often a most necessary part of worldly
 - anon.

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