NAME

cyrillic - Library for fast and easy cyrillic text manipulation

SYNOPSIS

use cyrillic qw/866 win2dos convert locase upcase detect/;

print convert( 866, 1251, $str );
print convert( 'dos','win', \$str );
print win2dos $str;

DESCRIPTION

If first import parameter is number of codepage then locale switched to they codepage. Specialisation (like 'win2dos') call faster then 'convert'. Easy adding new codepage. For they need only add codepage string.

FUNCTIONS

Library includes converting and helper functions: convert, upcase, locase, upfirst, lofirst; detect, charset.

At importing list might be listed named convertors. For Ex.:

use cyrillic qw/dos2win win2koi mac2dos ibm2dos/;

The following rules are correct for converting functions:

VAR may be SCALAR or REF to SCALAR.
If VAR is REF to SCALAR then SCALAR will be converted.
If VAR is ommited then $_ operated.
If function called to void context and VAR is not REF
then result placed to $_.
convert SRC_CP, DST_CP, [VAR]

Convert VAR from SRC_CP codepage to DST_CP codepage and returns converted string.

upcase CODEPAGE, [VAR]

Convert VAR to uppercase using CODEPAGE table and returns converted string.

locase CODEPAGE, [VAR]

Convert VAR to lowercase using CODEPAGE table and returns converted string.

upfirst CODEPAGE, [VAR]

Convert first char of VAR to uppercase using CODEPAGE table and returns converted string.

lofirst CODEPAGE, [VAR]

Convert first char of VAR to lowercase using CODEPAGE table and returns converted string.

charset CODEPAGE

Returns charset name for CODEPAGE.

detect ARRAY

Detect codepage of data in ARRAY and returns codepage number. If codepage not detected then returns undefined value;

EXAMPLES

use cyrillic qw/convert locase upcase detect dos2win win2dos/;

$\ = "\n";
$_ = "\x8F\xE0\xA8\xA2\xA5\xE2 \xF0\xA6\x88\xAA\x88!";

print; upcase 866;
print; dos2win;
print; win2dos;
print; locase 866;
print;
print detect $_;


# EQVIVALENT CALLS:

dos2win( $str );        # called to void context -> result placed to $_
$_ = dos2win( $str );

dos2win( \$str );       # called with REF to string -> direct converting
$str = dos2win( $str );

dos2win();              # with ommited param called -> $_ converted
dos2win( \$_ );
$_ = dos2win( $_ );


# FOR EASY SWITCH LOCALE CODEPAGE

use cyrillic qw/866/;   # locale switched to 866 codepage

use locale;
print $str =~ /(\w+)/;

no locale;
print $str =~ /(\w+)/;

AUTHOR

Albert MICHEEV <Albert@f80.n5049.z2.fidonet.org>

COPYRIGHT

Copyright (C) 2000, Albert MICHEEV

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

AVAILABILITY

The latest version of this library is likely to be available from:

http://www.perl.com/CPAN

2 POD Errors

The following errors were encountered while parsing the POD:

Around line 43:

'=item' outside of any '=over'

Around line 77:

You forgot a '=back' before '=head1'