I am trying to keep my distro
Env::Dot backwards compatible to Perl 5.10.1.
In order to do better error messaging, I have a nested evals which capture croaks from deeper in the program. Normal exception throw/catch stuff.
I noticed this strange behavior in Perl 5.10.1:
#!/usr/bin/env perl
use strict;
use warnings;
use Carp;
local $@ = undef;
eval {
local $@ = undef;
eval {
# croak __LINE__ . ':DEEPEST ERROR'; 1;
croak 'DEEPEST ERROR'; 1;
} or do {
my $e = $@;
warn __LINE__ . ":e=$e";
croak $e;
}; 1;
} or do {
my $e = $@;
warn __LINE__ . ":e=$e";
croak $e;
};
Output:
16:e=DEEPEST ERROR at ./test-recursive-evals.pl line 13.
eval {...} called at ./test-recursive-evals.pl line 14
eval {...} called at ./test-recursive-evals.pl line 19
21:e= at ./test-recursive-evals.pl line 21.
at ./test-recursive-evals.pl line 22.
In later Perl 5.14.4 this works as it should.
Is there a way around this bug, besides removing the nested evals?
Or perhaps it is time to stop supporting older than 5.14 or 5.16?