in reply to A useful use of goto
{ 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 = $@; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: A useful use of goto
by Corion (Patriarch) on Apr 11, 2010 at 21:55 UTC | |
|
Re^2: A useful use of goto
by The Perlman (Scribe) on Apr 11, 2010 at 22:06 UTC | |
|
Re^2: A useful use of goto
by The Perlman (Scribe) on Apr 11, 2010 at 21:54 UTC |