in reply to mmap in Perl?

And well it doesnt work

That's not exactly an elaborate error description. Does your computer blow up when you run it? or your kitten dies? Or do you maybe just get an error message? If yes, what is it?

Replies are listed 'Best First'.
Re^2: mmap in Perl?
by RobinV (Sexton) on Oct 19, 2009 at 12:24 UTC

    Well see that's it..
    My kittens die.. heh

    But indeed, I made a bit of a odd end that that error description. Well I wrote to scripts.The first one, and one that reads the file with mmap.

    The Reader works, but that piece of code should write to the mmapped file. But it doesn't even do that...

    The Writer doesn't do a thing at all.

    I hope I supplied enough information now.
    Thanks.

      Not yet.

      • Do you get an error message? If so, quote it exactly.
      • Is the mmapped file updated in any manner? If so, state precisely what happens
      • Does the script appear to execute and terminate? That may be part of the "enough information" we need to be helpful

        Ah so, Well lets just put down everything.

        [root@perlbox sandbox]# ls file1.pl file2.pl memory [root@perlbox sandbox]# cat memory XXXXXXXXXXXXXxxxxXxXXXXXXX [root@perlbox sandbox]# cat file1.pl use File::Map qw/:map lock_map sync/; use warnings; use strict; my $mmap = undef; my $file = "memory"; map_file $mmap, $file, '+<'; if (!defined($mmap)) { print "ERROR!!\n"; } for(my $i=0;$i<10000;++$i) { $mmap = $i; sync($mmap,1); } unmap ($mmap); [root@perlbox sandbox]# perl file1.pl [root@perlbox sandbox]# cat memory XXXXXXXXXXXXXxxxxXxXXXXXXX [root@perlbox sandbox]#

        So as you see it doesn't write to the memory file, while I would have guessed it would have write down some numbers, Since of..

        use File::Map qw/:map lock_map sync/; use warnings; use strict; my $mmap = undef; my $file = "memory"; map_file $mmap, $file, '+<'; if (!defined($mmap)) { print "ERROR!!\n"; } for(my $i=0;$i<10000;++$i) { <b>$mmap = $i;</b> sync($mmap,1); + } unmap ($mmap);

        the Bold code.
        Already thanks a lot. Is this the information required?