Thanx for above Re^4, RobinV. This contained the missing info & confirmed
the missing reader to be my suspected kitten, ahem - cat :). Btw. did you notice that
your indenting didn't quite survive pasting?
Observation: It looks to me like $mmap isn't synced to file (or maybe even to the mmapped memory?)
if the length changed, even if the new value _remains_ usable within the script. Modify your writer similar to the scrap below to make it work, but choose something more sensible than my substring mess.
# WORKS -- but it's suddenly quite slow due to synchronous sync :)
for(my $i=0;$i<105;++$i) {
substr($mmap,0,2) = substr($i . (" "x20) ,0,2);
sync($mmap,1);
}
Question: isn't this a bug / incomplete documentation? IMHO there should be a way to at least optionally turn on a warning or error somehow for this case, otherwise that's a good place for hard-to-find bugs. (I also forwarded the URL for this thread to the module's author for a rain check. Maybe I missed something when skimming the module's documentation)
Maybe worth a check: There are more mmap modules on CPAN besides File::Map
(Cache::FastMmap, Sys::Mmap + ::Simple, IPC::Mmap) some of which
may turn out to be less rigid in assignments, maybe allowing implied remapping, padding or substring-insertion for shorter assignments.