OK. Now that I'm thoroughly confused:-):
package Encode::ROT13;
use strict;
use warnings;
use Encode;
use parent qw( Encode::Encoding );
__PACKAGE__->Define( 'rot13' );
no warnings 'redefine';
sub encode($$;$){
my( $obj, $str, $chk ) = @_;
$str =~ tr/A-Za-z/N-ZA-Mn-za-m/;
$_[1] = '' if $chk;
return $str;
}
*decode = \&encode;
1;
package main;
use strict;
use warnings;
use Encode 'define_encoding';
use File::Slurp;
my $object = {};
bless($object, 'Encode::ROT13');
define_encoding( $object, 'rot13' );
my(@words) = read_file( \*DATA, chomp => 1, binmode => ':rot13' );
print "$_\n" for @words;
my(@list) = Encode->encodings();
print "Checking for rot13: \n";
foreach my $list(@list) {
print "\t$list\n";;
}
__DATA__
Apple
cat
dog
strawberry
watermelon