in reply to Use of $AUTOLOAD and strict

Yes, use vars qw ( $AUTOLOAD ); would do the trick. Better yet, so would the following:

sub AUTOLOAD { our $AUTOLOAD; my $subroutine_name = $AUTOLOAD; ... }

The ones that need to be declared are the ones not listed by the following:

perl -e "$,=$\=$/; print keys %::"

Replies are listed 'Best First'.
Re^2: Use of $AUTOLOAD and strict
by ambrus (Abbot) on May 12, 2005 at 08:53 UTC

    That's wrong. The ones that have to be declared are the ones not in perlvar. For example, $^W does not have to be declared, but perl -e "$,=$\=$/; print keys %::" does not print it.

    Update: the exact rule is in perlvar:

    Perl identifiers that begin with digits, control characters, or punctuation characters are exempt from the effects of the "package" declaration and are always forced to be in package "main"; they are also exempt from "strict 'vars'" errors. A few other names are also exempt in these ways: ENV STDIN INC STDOUT ARGV STDERR ARGVOUT _ SIG
      The docs you quoted support me. perlvar and some variables outsides of perlvar don't need to be declared. My snippet lists all the variables in perlvar AND the variables not listed in perlvar that it acknowledges. I did mean to mention the non-text variables from perlvar (e.g. $^W) don't need to be declared either.
        Note that both of these still leave out $a and $b, which are subject to the package statement yet do not need to be declared via use vars to be used inside a use strict environment.
        -- @/=map{[/./g]}qw/.h_nJ Xapou cets krht ele_ r_ra/; map{y/X_/\n /;print}map{pop@$_}@/for@/