My question has to do with the "magically appears in the global $AUTOLOAD variable of the same package as the AUTOLOAD routine" section....if an AUTOLOAD subroutine is defined in the package or packages used to locate the original subroutine, then that AUTOLOAD subroutine is called with the arguments that would have been passed to the original subroutine. The fully qualified name of the original subroutine magically appears in the global $AUTOLOAD variable of the same package as the AUTOLOAD routine
If $AUTOLOAD is initialized by perl as a global in the package the routine is in, why must it be fully qualified or explicitly declared with our when used within that package when strict is in use.
This error:# the following code throws a compile time error package TestPackage; use strict; sub AUTOLOAD { print $AUTOLOAD, " is not available\n"; } # this code is fine package TestPackage; use strict; our $AUTOLOAD; # 'use vars qw( $AUTOLOAD )' works too sub AUTOLOAD { print $AUTOLOAD, " is not available\n"; }
I'm sure I've misinterpreted, but I just don't see where.
In reply to Fully qualifying $AUTOLOAD by dsb
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |