Robert Fischer > Text-Shift-1.00 > Text::Shift

Download:
Text-Shift-1.00.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 1.00   Source  

NAME ^

Text::Shift - Perl extension for shifting text

SYNOPSIS ^

  use Text::Shift; 

  #############
  # Alphabets #
  #############

  # Report on current alphabets
  my @uc_alphabet = Text::Shift->uppercase();
  my @lc_alphabet = Text::Shift->lowercase();
  my @number_list = Text::Shift->numbers();

  # Set alphabets to something other than default
  Text::Shift->uppercase(("a".."p"),("Q".."Z"));
  Text::Shift->lowercase(("A".."P"),("q".."z"));
  Text::Shift->numbers((1..9),0);

  ################
  # Constructors #
  ################
  my $obj;
  $obj = Text::Shift->new(1);     # One value (1) for all shifts
  $obj = Text::Shift->new(1,2);   # Caps=Numbers=1, Small=2
  $obj = Text::Shift->new(1,2,3); # Caps=1, Lowercase=2, Numbers=3

  ###########################################
  # OTHER METHODS PROVIDED BY Crypt::Cipher #
  ###########################################

(See Crypt::Cipher for more methods.)

ABSTRACT ^

This class provides an object-oriented wrapper around shift ciphers. It is designed to provide a simple solution cleanly and unobtrusively. Shift ciphers are simple, and the code to use them should be simple, too.

DESCRIPTION ^

Overview

Shift Ciphers are based on the simple princple of mapping each letter to another letter "down the line". It works purely linearly. There are three distinct alphabets, one for uppercase, another for lowercase, and the last for numbers. Anything not contained in these alphabets are deleted from the resulting string, and each alphabet may be shifted a different magnitude.

Methods

Constructors

    CLASS->new(CAPMAG, [LOWMAG, NUMMAG])

Returns an instance of this class shifting the alphabets certain amounts. Note that the alphabets used at instantiation are the alphabets which this object will always use, and so changing the alphabets after object creation will have no effect on the older objects. Any value not supplied will default to CAPMAG or 0.

Accessors

    CLASS->uppercase()
    CLASS->lowercase()
    CLASS->numbers()

Returns a list consisting of the uppercase alphabet currently in use, the lowercase alphabet currently in use, and the numbers currenty in use. Note that because the accessors are named the same thing as the modifiers, it is important to use the parentheses here.

Modifiers

    CLASS->uppercase(LIST)
    CLASS->lowercase(LIST)
    CLASS->numbers(LIST)

Sets the uppercase, lowercase, or numbers alphabet in use for this package. Each package has a distinct "alphabetspace" which cannot be modified by anyone else. If you would like to change the default alphabets in use, please see the source code comments.

Performing the Shift

The methods to actually perform the shift are inherited from Crypt::Cipher.

HISTORY ^

1.00

Major rewrite; started from scratch and reconstructed the code to be more clear to both maintainers and the perl interpretater. The import routine was removed because it never worked in the first place. The information for the

0.03

Minor efficiency repairs.

0.02

Created import subroutine for alphabet control.

0.01

Original version; created by h2xs 1.22 with options

  -ABCXO
        -n
        Text::Shift

SEE ALSO ^

Crypt::Cipher

Parent class, providing many inherited methods including the following very useful methods:

    $obj->encipher(SCALAR)       # aka: $obj->encipher_string(SCALAR)
    $obj->encipher_scalar(SCALARREF)
    $obj->encipher_list(LIST)
    $obj->encipher_array(ARRAYREF)

AUTHOR ^

Robert Fischer, <chia@cpan.org>

COPYRIGHT AND LICENSE ^

Copyright 2003 by Robert Fischer

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

syntax highlighting: