The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Lingua::Klingon::Recode - Convert Klingon words between different encodings

VERSION

This document refers to version 1.02 of Lingua::Klingon::Recode, released on 2004-05-09.

SYNOPSIS

  use Lingua::Klingon::Recode;
  @copy = Lingua::Klingon::Recode::recode('XIFAN HOL',    # from
                                          'tlhIngan Hol', # to
                                          @original);

or

  use Lingua::Klingon::Recode ':all';
  @copy = recode 'XIFAN HOL', 'tlhIngan Hol', @original;

or

  # demonstrate scalar version for a change
  use Lingua::Klingon::Recode qw( recode );
  $copy = recode 'XIFAN HOL', 'tlhIngan Hol', $original;

DESCRIPTION

Overview

Lingua::Klingon::Recode is a module which allows you to convert Klingon text from one encoding to another.

For example, one frequently-used encoding is the so-called 'XIFAN HOL' encoding (after the encoded version of what is 'tlhIngan Hol' in the standard encoding).

All suported encodings can represent the same sounds, but they use different characters or sequences of characters to do so.

Most encodings have three allowable names (or aliasses): the transliteration of 'tlhIngan Hol', an abbreviated version with only 'tlhIngan', and an extended version "tlhIngan Hol Dajatlh'a'" (this extended version is mainly used to distinguish between related encodings that differ in how they represent the apostrophe).

The support encodings, with their recognised aliasses, are:

tlhIngan Hol, tlhIngan, tlhIngan Hol Dajatlh'a'

The standard encoding for Klingon; this is the usual transliteration.

tlhingan hol, tlhingan, tlhingan hol dajatlh'a'

This is the same as the standard encoding, except that all letters are lowercase. This has the grave disadvantage that 'q' and 'Q' are conflated, and that "ngh" can represent either "ng+H" or "n+gh" (it is interpreted as the former).

TLHINGAN HOL, TLHINGAN, TLHINGAN HOL DAJATLH'a'

This is the same as the standard encoding, except that all letters are uppercase. Again, 'q' and 'Q' cannot be distinguished in this encoding, and the sequence "NGH" is ambiguous.

XIFAN HOL, XIFAN, XIFAN HOL DAJAX'A'

This is the so-called "XIFAN HOL" encoding, used, for example, as the encoding of some fonts.

XIFANZ, XIFAN HOL DAJAXZAZ

This is the same encoding as the one above, but it uses Z for what is written ' (apostrophe) in the standard encoding, rather than the apostrophe. This encoding uses only the 26 letters of the uppercase Roman alphabet.

This encoding must be specified in its full form, or in the abbreviation 'XIFANZ'.

xifan hol, xifan, xifan hol dajax'a'

This is the "XIFAN HOL" encoding with all letters replaced by their lowercase form.

xifanz, xifan hol dajaxzaz

This is the "XIFAN HOL" encoding with all letters replaced by their lowercase form, and with 'z' rather than "'" for the apostrophe. This encoding uses only the 26 letters of the lowercase Roman alphabet.

uhmal gnj, uhmal, uhmal daiauzaz

This is an encoding formed by representing each Klingon letter in the standard transliteration with a lower-case Roman letter in alphabetical order according to the standard transliteration. It is also the encoding currently used by Lingua::Klingon::Collate. It can be represented as followed:

    tlhIngan Hol  a   b   ch  D   e   gh  H   I   j   l   m   n   ng
    uhmal gnj     a   b   c   d   e   f   g   h   i   j   k   l   m

    tlhIngan Hol  o   p   q   Q   r   S   t   tlh u   v   w   y   '
    uhmal gnj     n   o   p   q   r   s   t   u   v   w   x   y   z
UHMAL GNJ, UHMAL, UHMAL GNJ DAIAUZAZ

This is the uppercase version of the 'uhmal gnj' encoding.

Exports

Lingua::Klingon::Recode exports no functions by default, in order to avoid namespace pollution. However, all functions listed here can be imported explicitly by naming them, or they can be imported all together by using the tag ':all'.

recode

This is currently the only subroutine in this module.

It takes at least three parameters:

  • "from" encoding

  • "to" encoding

  • one or more strings

The strings are converted from the "from" encoding to the "to" encoding.

In list context, returns all the converted strings. In scalar context, returns the first converted string.

BUGS

The 'tlhingan hol' and 'TLHINGAN HOL' encodings lose information; this is inherent in their definition. Do not use these encodings unless you really need to.

No bugs in the code itself are currently known.

Please report any bugs found through http://rt.cpan.org/ or by emailing the author.

SEE ALSO

Lingua::Klingon::Collate

FEEDBACK

If you use this module, I'd appreciate it if you drop me a line at the email address in "AUTHOR", just so that I have an idea of how many people use this module at all. Also, if you have any comments, feel free to email me.

AUTHOR

Philip Newton, <pne@cpan.org>

COPYRIGHT AND LICENSE

Copyright (C) 2003, 2004 by Philip Newton. All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

  • Neither the name of Philip Newton nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.