Subject: | local $@ in "sub maketext" prevents perl-ish exeptions dispatch |
Localization of $@ in "maketext" in v1.12 has a side-effect of
cancelling standard way of how Perl programs handle exceptions (script
deaths).
This is due to two Carp::croak calls placed after "local $@".
Of course, there is $handle->fail_with( ... ) callback to overcome this
issue, but the less-surprise behavior is to not discard _standard_
exception information on death so the programmer has at least an option
to know why the script has failed.
Previous Locale::Maketext (e.g. 1.09) do not suffer from this issue.
Solution is to croak off the localization scope, for example:
my $exception;
TRY:
{
local $@;
# ...
$exception = "First exception"; last TRY;
# ...
$exception = "Second exception"; last TRY;
return $value; # Successful exit
}
$exception and Carp::croak( $exception );