Subject: | Attempt to free unreferenced scalar when used with Package::Stash |
Perl is throwing a "free unreferenced scalar" error when pairmap is
used in conjunction with Package::Stash (0.36). I'm not sure which
package is at fault, but the error is thrown at a line number after
the pairgrep invocation (not within it), so I'm guessing(!) it might
by Package::Stash.
Here's the failing code:
use Package::Stash;
use List::Util 'pairmap';
my $m = Package::Stash->new('main');
my %h = ( a => 1, b => 2 );
pairmap {
$m->add_symbol( '$'. $a, $b )
} %h;
print $a;
and here are the results when run under either 5.16.3 or 5.20.0:
Attempt to free unreferenced scalar: SV 0x13bc5e0, Perl interpreter: 0x1347010 at t1.pl line 14.
Attempt to free unreferenced scalar: SV 0x1368f18, Perl interpreter: 0x1347010.
A simple loop over the hash rather than using pairmap works fine.
Thanks,
Diab