Subject: | Silently fails if 'my' variable given in catch |
If you say 'catch (my $x)' then the try/catch block silently fails to
work. Example program:
use 5.014;
use TryCatch;
try {
say 'testing thing that dies';
die 'urk';
say 'called';
}
catch (my $x) {
say "caught error";
}
say 'hello';
I expected this to print
testing thing that dies
caught error
hello
but instead it prints
urk at wacsl_decompose line 6.
...propagated at wacsl_decompose line 12.
testing thing that dies
showing that the error has not been caught.
I understand that 'catch ($x)' creates a new lexically scoped variable
$x - although this is not crystal clear from the documentation.
However, if 'catch (my $x)' is given instead, it should do something
sensible, such as giving an error message or working the same as 'catch
($x)'.