Leon Timmermans > File-Map-0.54 > File::Map

Download:
File-Map-0.54.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  2
Open  0
View/Report Bugs
Module Version: 0.54   Source   Latest Release: File-Map-0.62

NAME ^

File::Map - Memory mapping made simple and safe.

VERSION ^

version 0.54

SYNOPSIS ^

 use File::Map 'map_file';
 
 map_file my $map, $filename;
 if ($map ne "foobar") {
     $map =~ s/bar/quz/g;
     substr $map, 1024, 11, "Hello world";
 }

DESCRIPTION ^

File::Map maps files or anonymous memory into perl variables.

Advantages of memory mapping

Advantages of this module over other similar modules

FUNCTIONS ^

Mapping

The following functions for mapping a variable are available for exportation.

Auxiliary

Locking

These locking functions provide locking for threads for the mapped region. The mapped region has an internal lock and condition variable. The condition variable functions(wait_until, notify, broadcast) can only be used inside a locked block. If your perl has been compiled without thread support the condition functions will not be available.

CONSTANTS

PROT_NONE, PROT_READ, PROT_WRITE, PROT_EXEC, MAP_ANONYMOUS, MAP_SHARED, MAP_PRIVATE, MAP_ANON, MAP_FILE

These constants are used for sys_map. If you think you need them your mmap manpage will explain them, but in most cases you can skip sys_map altogether.

EXPORTS ^

All previously mentioned functions are available for exportation, but none are exported by default. Some functions may not be available on your OS or your version of perl as specified above. A number of tags are defined to make importation easier.

DIAGNOSTICS ^

Exceptions

Warnings

DEPENDENCIES ^

This module depends on perl 5.8, Const::Fast and PerlIO::Layers. Perl 5.8.8 or higher is recommended because older versions can give spurious warnings.

On perl versions before 5.11.5 many string functions including substr are limited to 32bit logic, even on 64bit architectures. Effectively this means you can't use them on strings bigger than 2GB. If you are working with such large files, it is strongly recommended to upgrade to 5.12.

PITFALLS ^

BUGS AND LIMITATIONS ^

There is an off-by-one bug in Perl's regexp engine, as explained here. If the length of the file is an exact multiple of the page size, some regexps can trigger a segmentation fault. This can not be fixed in this module though.

As any piece of software, bugs are likely to exist here. Bug reports are welcome.

Please report any bugs or feature requests to bug-file-map at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=File-Map. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

Unicode file mappings are known to be buggy on perl 5.8.7 and lower.

SEE ALSO ^

AUTHOR ^

Leon Timmermans <fawaka@gmail.com>

COPYRIGHT AND LICENSE ^

This software is copyright (c) 2008 by Leon Timmermans.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

syntax highlighting: