The fact of using $_ rather than $@ within catch {} blocks has a couple of unfortunate effects:
1) You lose access to $ from outside the try/catch. This has never really bothered me, but I could see it bugging someone who uses $ in iterations more than I do.
2) Setting $@ is the only way to get PROPAGATE from Perl exceptions. The fact that T::T uses a different variable makes anyone who wants PROPAGATE to do local $@ = $_; within every catch {} where we might potentially rethrow the exception. This is annoying.
I propose a flag, and/or some other means, of telling Try::Tiny to set a local()ized $@ as the exception variable within catch {} blocks.
The fact of using $_ rather than $@ within catch {} blocks has a couple of unfortunate effects:
1) You lose access to $ from outside the try/catch. This has never really bothered me, but I could see it bugging someone who uses $ in iterations more than I do.
2) Setting $@ is the only way to get PROPAGATE from Perl exceptions. The fact that T::T uses a different variable makes anyone who wants PROPAGATE to do
local $@ = $_;
within every catch {} where we might potentially rethrow the exception. This is annoying.I propose a flag, and/or some other means, of telling Try::Tiny to set a local()ized $@ as the exception variable within catch {} blocks.
Thoughts?