Subject: | It would be really handy to have the try return value in finally |
I notice finally has been added and thought great, this will be a good
for my test code but I don't know what try will return in the finally
block. Consider:
use Test::More;
try {
die "fred\n" if $something;
1;
} catch {
diag("died with $_");
0;
} finally {
# some cleanup code
# following does not work as finally does not know what try will
return
ok($_[0], "test ok");
};
so now I have to do:
my $x = try {
die "fred\n" if $something;
1;
} catch {
diag("died with $_");
0;
} finally {
# some cleanup code
};
ok($x, "test ok");
Does not make a massive difference but it would be really neat to know
in finally what try was going to return. I imagine it must be known by
then.
Martin
--
Martin J. Evans
Wetherby, UK