PerlIO-Util reviews

cpanratings
 

RSS | Module Info | Add a review of PerlIO-Util

PerlIO-Util (0.54) *****

PerlIO::Util is one of those simple gems that make your life easier. It provides a couple of PerlIO layers (think open() modes) that are damn convenient. Maybe it's best to give an example, this is for file locking:

use Fcntl qw/:flock/;
open my $fh, '<', "file" or die "Some error: $!";
flock $fh, LOCK_SH or die "Could not get lock on file 'file': $!";
#...
close $fh;

becomes simply

use PerlIO::Util;
open my $fh, '< :flock', "file" or die "Some error: $!"
#...
close $fh;

and it checks your open mode to see whether you'd need a shared or exclusive lock. Also, no magic constants from Fcntl. Not a big deal, but just one less thing to worry about.