Subject: | mmap turning ref into map |
Date: | Fri, 16 Apr 2010 09:02:22 +1000 |
To: | bug-File-Map [...] rt.cpan.org |
From: | Kevin Ryde <user42 [...] zip.com.au> |
With File::Map 0.24 on debian i386,
use File::Map 'map_file';
my $x;
my $y = \$x;
map_file ($y, '/etc/motd', '<');
print $y;
gets an assert failure
perl: lib/File/Map.xs:186: reset_var: Assertion `!((var)->sv_flags & 0x00000800) || !((var)->sv_u.svu_rv)' failed.
and the process abort()s.
I hoped it would turn $y into an mmapped string. I think that'd be
desirable, but if there's some reason it's impossible then I'd hope it
could croak, not abend.
For what it's worth the same thing happens in File::Map 0.23, so
presumably it's not related to what prototypes did vs no longer do to
references :-).