I made a similar mistake once long ago, and now spot the pattern.
p4raw-id: //depot/perl@29385
sub short_error_loc {
- my $cache;
+ # You have to create your (hash)ref out here, rather than defaulting it
+ # inside trusts *on a lexical*, as you want it to persist across calls.
+ # (You can default it on $_[2], but that gets messy)
+ my $cache = {};
my $i = 1;
my $lvl = $CarpLevel;
{
sub trusts {
my $child = shift;
my $parent = shift;
- my $cache = shift || {};
+ my $cache = shift;
my ($known, $partial) = get_status($cache, $child);
# Figure out consequences until we have an answer
while (@$partial and not exists $known->{$parent}) {