Subject: | Should warn on buffer size change |
The module should issue its "Writing directly to a memory mapped file is not recommended" warning when the buffer is shrunk.
$ perl -e'print "\0"x100' >scratch
$ perl -MFile::Map=map_file -we'
map_file my $map, "scratch", "+<";
substr($map, 0, 100, "3" x 100);
substr($map, 98, 2, "");
'
$ od -t x1 scratch
0000000 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33
*
0000140 33 33 00 33
0000144
This just requires a small change to the C<< if (SvPVX(var) != info->fake_address) >> check in mmap_write.