[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]
some method calls not autoloaded
The following only gets to autoload once, not twice:
$ perl -wle'sub AUTOLOAD{print"$AUTOLOAD!"} main->unimport; main->important'
main::important!
Is it correct for unimport and import to not autoload?
If so, the following documents it that way:
--- perl/pod/perlfunc.pod.orig 2003-08-25 15:25:14.000000000 -0700
+++ perl/pod/perlfunc.pod 2003-09-02 00:16:42.000000000 -0700
@@ -2736,7 +2736,7 @@
=item no Module
-See the C<use> function, which C<no> is the opposite of.
+See the C<use> function, of which C<no> is the opposite.
=item oct EXPR
@@ -6160,7 +6160,8 @@
C<import> method any way it likes, though most modules just choose to
derive their C<import> method via inheritance from the C<Exporter> class that
is defined in the C<Exporter> module. See L<Exporter>. If no C<import>
-method can be found then the call is skipped.
+method can be found then the call is skipped, even if there is an AUTOLOAD
+method.
If you do not want to call the package's C<import> method (for instance,
to stop your namespace from being altered), explicitly supply the empty list:
@@ -6200,6 +6201,8 @@
There's a corresponding C<no> command that unimports meanings imported
by C<use>, i.e., it calls C<unimport Module LIST> instead of C<import>.
+It behaves exactly as C<import> does with respect to VERSION, an
+omitted LIST, empty LIST, or no unimport method being found.
no integer;
no strict 'refs';
--- perl/pod/perlsub.pod.orig 2003-03-21 13:54:26.000000000 -0800
+++ perl/pod/perlsub.pod 2003-09-02 11:11:35.000000000 -0700
@@ -1259,7 +1259,7 @@
the argument C<"Foo/Bar.pm"> in @_. See L<perlfunc/require>.
And, as you'll have noticed from the previous example, if you override
-C<glob>, the C<E<lt>*E<gt>> glob operator is overridden as well.
+C<glob>, the C<< <*> >> glob operator is overridden as well.
In a similar fashion, overriding the C<readline> function also overrides
the equivalent I/O operator C<< <FILEHANDLE> >>.
@@ -1279,7 +1279,8 @@
of the original subroutine magically appears in the global $AUTOLOAD
variable of the same package as the C<AUTOLOAD> routine. The name
is not passed as an ordinary argument because, er, well, just
-because, that's why...
+because, that's why. (As an exception, a method call to a nonexistent
+C<import> or C<unimport> method is just skipped instead.)
Many C<AUTOLOAD> routines load in a definition for the requested
subroutine using eval(), then execute that subroutine using a special
@@ -1305,7 +1306,7 @@
use subs qw(date who ls);
date;
who "am", "i";
- ls -l;
+ ls '-l';
A more complete example of this is the standard Shell module, which
can treat undefined subroutine calls as calls to external programs.
End of Patch.
- Follow-Ups from:
-
Rafael Garcia-Suarez <rgarciasuarez@free.fr>
[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]