I think not, as with AUTOLOAD, you mostly leave the current scope and enter the scope of the target subroutine:
use strict; use Carp qw(croak); use vars qw($AUTOLOAD); my %handler = ( hello => sub { print "Hello World\n" }, ); sub AUTOLOAD { (my $fn = $AUTOLOAD) =~ s/.*:://g; if (exists $handler{ $fn }) { goto &{ $handler{ $fn } } }; croak "Unknown method '$AUTOLOAD' called."; }; hello();
In the above example, we only leave enclosed scopes and don't goto into an inner scope. Potentially (but I can't test this currently, due to lack of a 5.12), the following could fall under "goto into an inner scope", but I think it's not really into in this case:
use strict; use Carp qw(croak); use vars qw($AUTOLOAD); sub AUTOLOAD { (my $fn = $AUTOLOAD) =~ s/.*:://g; my %handler = ( hello => sub { print "Hello World\n" }, ); if (exists $handler{ $fn }) { goto &{ $handler{ $fn } } }; croak "Unknown method '$AUTOLOAD' called."; }; hello();
Here, the handlers are arguably in an inner scope, relative to AUTOLOAD. But what I think the change note really means is that jumping "into (the middle of) an inner scope" is deprecated:
START: goto INSIDE; OUTSIDE: if (0) { INSIDE: print "Hello "; INSIDE2: print "World\n"; };
Here, I think the labels INSIDE and INSIDE2 are not reachable from START (or rather, reaching them is deprecated with 5.12), while OUTSIDE is reachable.
AUTOLOAD subroutines are not affected by that, unless you goto into the body of such a subroutine by holding onto a label within that subroutine, but that's not related to AUTOLOAD:
my $handler = sub { INSIDE: print "Hello "; INSIDE2: print "World\n"; }; goto INSIDE; # deprecated goto INSIDE2; # deprecated goto &$handler; # still works, as we start "just on the outside" of $h +andler
In reply to Re^2: Perl 5.12.0 has been released!
by Corion
in thread Perl 5.12.0 has been released!
by ikegami
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |