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

POD enhancement - sub INC { }

Thread Next
From:
Sam Vilain
Date:
September 30, 2003 10:30
Subject:
POD enhancement - sub INC { }
Message ID:
200309301830.15864.sam@vilain.net
These two snippets should be the same:

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

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

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
+information.
 
 For a yet-more-powerful import facility, see L</use> and L<perlmod>.
 
-- 
Sam Vilain, sam@vilain.net

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


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About