I'm trying out the Error module. The doc says:
catch CLASS with BLOCK: This clause will cause all errors that satisfy "$err->isa(CLASS)" to be caught and handled by evaluating "BLOCK". "BLOCK" will be passed two arguments. The first will be the error being thrown. The second is a reference to a scalar variable. If this variable is set by the catch block then, on return from the catch block, try will continue processing as if the catch block was never found.Now, is it possible to continue to the point right after the exception was originally thrown, while still have the exception handled first?
use Error qw(:try);
sub foo {
throw Error::Simple \-text => "oops";
print "1\n";
}
try {
foo();
}
catch Error::Simple with {
my ($err, $cont) = @_;
print "2\n";
$$cont = 1;
};
I want both print statements to print. If I don't surround the throw(), only "2" is printed. If I do, only "1" is printed.
Imagine the old DOS' "abort, retry, continue" scenario.
In reply to Can we continue after an exception? by dgaramond2
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |