PerlIO::via::Rotate - PerlIO layer for encoding using rotational deviation
use PerlIO::via::Rotate; # assume rot13 only use PerlIO::via::Rotate 17; # only a single rotation use PerlIO::via::Rotate qw( 13 14 15 ); # list rotations (rotxx) to be used use PerlIO::via::Rotate ':all'; # allow for all rotations 0..26 open( my $in, '<:via(rot13)', 'file.rotated' ) or die "Can't open file.rotated for reading: $!\n"; open( my $out, '>:via(rot14)', 'file.rotated' ) or die "Can't open file.rotated for writing: $!\n";
This documentation describes version 0.08.
This module implements a PerlIO layer that works on files encoded using rotational deviation. This is a simple manner of encoding in which pure alphabetical letters (a-z and A-Z) are moved up a number of places in the alphabet.
The default rotation is "13". Commonly this type of encoding is referred to as "rot13" encoding. However, any rotation between 0 and 26 inclusive are allowed (albeit that rotation 0 and 26 don't change anything). You can specify the rotations you would like to use as strings in the -use- statement
The special keyword ":all" can be specified in the -use- statement to indicate that all rotations between 0 and 26 inclusive should be allowed.
This module is special insofar it serves as a front-end for 27 modules that are named "PerlIO::via::rot0" through "PerlIO::via::rot26" that are eval'd as appropriate when the module is -use-d. The reason for this approach is that it is currently impossible to pass parameters to a PerlIO layer when opening a file. The name of the module is the implicit parameter being passed to the PerlIO::via::Rotate module.
Inspired by Crypt::Rot13.pm by Julian Fondren.
Also thanks to Ribasushi for pointing out at the first Niederrhein PM meeting in 10 years, that the module version check is done by UNIVERSAL::VERSION, and that you can bypass this by providing your own VERSION class method.
Copyright (C) 2002, 2003, 2004, 2012 Elizabeth Mattijsen. All rights reserved. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.