Subject: | Frames from eval blocks getting ignored by Devel::Caller |
Tested on Perl v5.26.
If there are eval blocks in the path of calls, Devel::Caller::called_with($level, 1), which gets variable names, skips frames corresponding to eval blocks. This results in a fatal crash when the requested level is higher than expected (which also shouldn't happen).
How to verify:
use strict;
use warnings;
test();
sub test {
eval {
get_names_from_last_frame();
};
}
sub get_names_from_last_frame {
my $max_frame = 0;
while (my @call = caller $max_frame) {
$max_frame++;
}
my @names = Devel::Caller::called_with($max_frame, 1);
}