John Deighan wrote:
I need to be able to jump to the end of the enclosing eval block, just
like a die() does, but without setting [EMAIL PROTECTED] Is there a way to do that?
(I've checked the Perl docs, but couldn't find it). I could possibly
die() with a specific string, then use "if ($@ && ($@ ne <string>))" as
the error trap, but that's aesthetically unpleasing.
How about a simple return?
eval {
# do stuff
# ...
return if $some_reason;
# do stuff that might break
# ...
die $some_message if $something_broke;
};
if($@) {
print "ouch! $@";
}
# on with the show
# ...
You can also return values to outside the eval:
my $ret = eval {
return 1;
};
# $ret is now 1
If you're interested in why, here's the explanation. Our web site is
implemented via a series of "opcodes". The opcode is passed in the URL.
Sounds a lot like CGI::Application. I can recommend it.
Rhesa
_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs