| 1 |
File::Map |
| 2 |
|
| 3 |
File::Map is a module that maps files or anonymous memory into perl variables. |
| 4 |
|
| 5 |
Advantages of memory mapping |
| 6 |
* Unlike normal perl variables, mapped memory is shared between |
| 7 |
threads or forked processes. |
| 8 |
|
| 9 |
* It is an efficient way to slurp an entire file. Unlike for example |
| 10 |
File::Slurp, this module returns almost immediately, loading the |
| 11 |
pages lazily on access. This means you only 'pay' for the parts of |
| 12 |
the file you actually use. |
| 13 |
|
| 14 |
* Perl normally never returns memory to the system while running, |
| 15 |
mapped memory can be returned. |
| 16 |
|
| 17 |
Advantages of this module over other similar modules |
| 18 |
Safety and Speed |
| 19 |
This module is safe yet fast. Alternatives are either fast but can cause |
| 20 |
segfaults or loose the mapping when not used correctly, or are safe but |
| 21 |
rather slow. File::Map is as fast as a normal string yet safe. |
| 22 |
|
| 23 |
Simplicity |
| 24 |
It offers a more simple interface targeted at common usage patterns |
| 25 |
|
| 26 |
* Files are mapped into a variable that can be read just like any |
| 27 |
other variable, and it can be written to using standard Perl |
| 28 |
techniques such as regexps and "substr". |
| 29 |
|
| 30 |
* Files can be mapped using a set of simple functions. No weird |
| 31 |
constants or 6 argument functions. |
| 32 |
|
| 33 |
* It will automatically unmap the file when the scalar gets destroyed. |
| 34 |
This works correctly even in multithreaded programs. |
| 35 |
|
| 36 |
Portability |
| 37 |
File::Map supports both Unix and Windows. |
| 38 |
|
| 39 |
Thread synchronization |
| 40 |
It has built-in support for thread synchronization. |
| 41 |
|
| 42 |
INSTALLATION |
| 43 |
|
| 44 |
To install this module, run the following commands: |
| 45 |
|
| 46 |
perl Build.PL |
| 47 |
./Build |
| 48 |
./Build test |
| 49 |
./Build install |
| 50 |
|
| 51 |
SUPPORT AND DOCUMENTATION |
| 52 |
|
| 53 |
After installing, you can find documentation for this module with the |
| 54 |
perldoc command. |
| 55 |
|
| 56 |
perldoc File::Map |
| 57 |
|
| 58 |
You can also look for information at: |
| 59 |
|
| 60 |
RT, CPAN's request tracker |
| 61 |
http://rt.cpan.org/NoAuth/Bugs.html?Dist=File-Map |
| 62 |
|
| 63 |
AnnoCPAN, Annotated CPAN documentation |
| 64 |
http://annocpan.org/dist/File-Map |
| 65 |
|
| 66 |
CPAN Ratings |
| 67 |
http://cpanratings.perl.org/d/File-Map |
| 68 |
|
| 69 |
Search CPAN |
| 70 |
http://search.cpan.org/dist/File-Map |
| 71 |
|
| 72 |
|
| 73 |
COPYRIGHT AND LICENCE |
| 74 |
|
| 75 |
Copyright (C) 2008 Leon Timmermans |
| 76 |
|
| 77 |
This program is free software; you can redistribute it and/or modify it |
| 78 |
under the same terms as Perl itself. |
| 79 |
|