Doug Hoytehttp://cpanratings.perl.org/dist/fractal#11376
Rating: 5 stars
Very useful module for avoiding expensive copies of large strings.Doug HoyteDoug Hoytehttp://cpanratings.perl.org/dist/fractal#11374
Rating: 1 stars
This module does not work like Common Lisp's unwind-protect. The CL unwind-protect form guarantees that the clean-up block will be executed no matter how the protected block is exited.
However, Unwind::Protect does not run the clean-up block if you exit from the protected block with a goto or if the protected block calls exit().
I have created the Protect::Unwind module so that hopefully Common Lisp programmers new to perl will not use the buggy Unwind::Protect module.Doug HoyteDoug Hoytehttp://cpanratings.perl.org/dist/fractal#11372
Rating: 5 stars
Very useful module for comparing debian-style version numbers (which are much nicer than perl-style version numbers... just saying :).
Overloads <=>, <, >, etc to work exactly like you'd expect them to.Doug HoyteDoug Hoytehttp://cpanratings.perl.org/dist/fractal#11370
Rating: 5 stars
This module allows you to find all the ways that a regexp matches, not just the first one it finds.
Essentially it works by appending the following to the end of the supplied regexp:
(?{ record_match(); })(*FAIL)
Every match that makes it to the end of your regexp will have its offset and length (and, very importantly, $^R) recorded. Then the regexp will be artificially FAILed, invoking the regexp engine's backtracking behaviour in order to find the next match.
This module is careful not to needlessly copy your supplied input string which is nice for efficiency.
Not useful that often, but very useful when you need it.Doug HoyteDoug Hoytehttp://cpanratings.perl.org/dist/fractal#11368
Rating: 3 stars
This module is essentially a super-optimised PSGI server. Although this sort of micro-optimisation is not necessarily useful for most web applications, the way this module works is very interesting and might have some great niche applications.
Unfortunately, it doesn't seem as though this module is maintained at all. There are some fairly critical bugs in the github tracker that have been debugged and solved in the comments but have not been fixed by upstream.Doug HoyteDoug Hoytehttp://cpanratings.perl.org/dist/fractal#11366
Author here.
Thanks for your comments Dana.
- On windows I'm definitely planning on using Crypt::Random::Seed. I just need to get a windows VM up and running so I can test it (patches welcome).
- It's true that Session::Token doesn't itself include code for seeding from anything other than /dev/urandom. However, if you prefer to seed from another source, feel free to generate the seed data however you like and pass it in as the seed parameter to the Session::Token constructor.
Cheers,
DougDoug HoyteDoug Hoytehttp://cpanratings.perl.org/dist/fractal#11364
Rating: 4 stars
This is a well designed module and is nearly always preferable to the classic Sys::Mmap. Unlike Sys::Mmap, it will clean up mappings when they are no longer needed because all variables referencing them have gone out of scope.
A couple minor issues with File::Map:
* File::Map contains partial interfaces to msync/mlock/mprotect/madvise. I feel that these interfaces should be in separate modules, not bundled together with a file mapping module since they can be useful even when you aren't directly using mmap().
* There is no way to create MAP_FIXED mappings (although you generally don't need this).
* The dependency tree seems slightly excessive.
Although not an issue with this module, as it says in the documentation you should be aware that there is a bug in perl versions before 5.17.5 where regular expressions can read one byte past the end of a string. This can segfault your perl process if you create mappings that are exact multiples of your page size (and your OS doesn't create adjacent mappings):
$ uname -a
OpenBSD saturn 5.1 GENERIC#181 amd64
$ perl -E 'say $^V'
v5.12.2
$ perl -MFile::Map -e 'File::Map::map_file my $str, "/dev/zero", "<", 0, 4096; $str =~ /.$/'
Segmentation fault (core dumped)Doug HoyteDoug Hoytehttp://cpanratings.perl.org/dist/fractal#11362
Rating: 2 stars
Although this module mostly does what it claims to, it is too low-level to be used reliably from perl. Instead, check out File::Map.
The biggest issue with Sys::Mmap is that it is difficult to ensure that mappings are always unmapped when you are finished with them:
use Sys::Mmap;
eval {
open(my $fh, "/etc/passwd") || die;
mmap(my $str, 0, PROT_READ, MAP_SHARED, $fh) || die;
die "Something bad happened!";
munmap($str);
close($fh);
};
## Mapping still exists (but $fh was closed)
With File::Map your mappings will be unmapped automatically:
use File::Map;
eval {
File::Map::map_file my $str, "/etc/passwd", '<';
die "Something bad happened!";
};
## Mapping has been released
Other issues with Sys::Mmap:
* It is not as portable as File::Map which also supports windows.
* The synopsis seems to be wrong. You have to do "new Sys::Mmap", not "new Mmap". But don't use this interface since it doesn't seem to be possible to clean up mappings after they are no longer needed.
* There is no way to create MAP_FIXED mappings (although you generally don't need this).
Although not an issue with this module, you should be aware that there is a bug in perl versions before 5.17.5 where regular expressions can read one byte past the end of a string. This can segfault your perl process if you create mappings that are exact multiples of your page size (and your OS doesn't create adjacent mappings):
$ uname -a
OpenBSD saturn 5.1 GENERIC#181 amd64
$ perl -E 'say $^V'
v5.12.2
$ perl -MSys::Mmap -e 'open($fh, "/dev/zero"); mmap($str, 4096, PROT_READ, MAP_ANON, $fh); $str =~ /.$/;'
Segmentation fault (core dumped)Doug HoyteDoug Hoytehttp://cpanratings.perl.org/dist/fractal#11358
Rating: 5 stars
The most comprehensive collection of open source sorting network algorithm implementations in any language.
Not only can it compile networks to C, perl, or any other language, but it can also instrument sorting network designs and draw very nice knuth diagrams in SVG, postscript, and ASCII-art.
Documented. Well-tested. A responsive and knowledgeable author.Doug Hoyte