use strict; use warnings; use File::Map; # the mmap magic on $str is held, # no munmap until program exit # create /tmp/foo.tmp open my $fh, '+>', '/tmp/foo.tmp' or die; print $fh ("Z" x 512) or die; close $fh or die; sub foo { my $str; open my $fh, '+<', '/tmp/foo.tmp' or die; File::Map::map_handle ($str, $fh, '+>', 0, 512); close $fh or die; substr($str,0,1) = 'o'; } print "foo() runs ...\n"; foo(); print "\"fuser /tmp/foo.tmp\" says ...\n"; system 'fuser /tmp/foo.tmp'; print "end\n"; exit 0;Thread Previous | Thread Next