{ no strict 'refs'; # We don't want to introduce another scope, as that will # negate the effect of the local: NEXT: my $n = shift @handlers; local *{$n} = $handler{ $n }; goto NEXT if @handlers; $ok = eval $cfg_str; $err = $@; }
The code is inside a loop (yes it is) so there is no need to use goto:
NEXT: { no strict 'refs'; # We don't want to introduce another scope, as that will # negate the effect of the local: my $n = shift @handlers; local *{$n} = $handler{ $n }; redo NEXT if @handlers; $ok = eval $cfg_str; $err = $@; }
Or perhaps:
{ no strict 'refs'; # We don't want to introduce another scope, as that will # negate the effect of the local: NEXT: { my $n = shift @handlers; local *{$n} = $handler{ $n }; redo NEXT if @handlers; } $ok = eval $cfg_str; $err = $@; }
In reply to Re: A useful use of goto
by jwkrahn
in thread A useful use of goto
by Corion
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |