Name : perl-PerlIO-via-Unidecode
| |
Version : 1.02
| Vendor : obs://build_opensuse_org/devel:languages:perl
|
Release : 5.25
| Date : 2019-11-19 20:28:50
|
Group : Development/Libraries/Perl
| Source RPM : perl-PerlIO-via-Unidecode-1.02-5.25.src.rpm
|
Size : 0.01 MB
| |
Packager : (none)
| |
Summary : Perlio Layer for Unidecode
|
Description :
PerlIO::via::Unidecode implements a the PerlIO::via manpage layer that applies Unidecode (the Text::Unidecode manpage) to data passed through it.
You can use PerlIO::via::Unidecode on already-Unicode data, as in the example in the SYNOPSIS; or you can combine it with other layers, as in this little program that converts KOI8R text into Unicode and then feeds it to Unidecode, which then outputs an ASCII transliteration:
% cat transkoi8r use strict; use PerlIO::via::Unidecode; foreach my $filespec (AATTARGV) { open( # Three-argument open is always great my $IN, \'< :encoding(koi8-r):via(Unidecode)\', # the layers $filespec ) or die $!;
print while < $IN> close($IN); } __END__
% cat fet_koi8r.txt
����� ������ �� ����������� ������, ��� ������ ������� ��� ������ ���� ������ � ������� ������� ���������� ������,- �� ��������� �� � ���?
% transkoi8r fet_koi8r.txt
Koghda chitala ty muchitiel\'nyie stroki, Gdie sierdtsa zvuchnyi pyl siian\'ie l\'iet krughom I strasti rokovoi vzdymaiutsia potoki,- Nie vspomnila l\' o chiem?
Of course, you could do this all by manually calling Text::Unidecode\'s \'unidecode(...)\' function on every line you fetch, but that\'s just what \':via(...)\' layers do automatically do for you.
Note that you can also use \':via(Unidecode)\' as an output layer too. In that case, add a dummy \":utf8\" after it, as below, just to silence some \"wide character in print\" warnings that you might otherwise see.
% cat writebei.pl use PerlIO::via::Unidecode; open( my $OUT, \">:via(Unidecode):utf8\", # the layers \"roman_bei.txt\" ) or die $!; print $OUT \"\\x{5317}\\x{4EB0}\ \"; close($OUT);
% perl writebei.pl
% cat roman_bei.txt Bei Jing
|
RPM found in directory: /packages/linux-pbone/ftp5.gwdg.de/pub/opensuse/repositories/devel:/languages:/perl:/CPAN-P/openSUSE_Tumbleweed/noarch |