The object-oriented interface to Text::Kakasi is deceiving and of
limited usefulness, because each object does not maintain its own state.
As you can see in the attached test script, each new instantiation of a
Text::Kakasi object causes all previous instantiations to operate with
the new parameters, thus removing (for me) most of the advantage of
using the OO interface.
Thanks for your attention to this !
--
--kulp
Subject: | kakasi.pl |
#!/usr/bin/env perl
use strict;
use Encode;
use Text::Kakasi;
local $\ = "\n";
sub _e { encode("UTF-8", shift) }
my $a = Text::Kakasi->new(qw(-iutf8 -outf8 -Ja -Ha -Ka -Ea -s));
print _e $a->get("éèª");
print "-" x 80;
my $b = Text::Kakasi->new(qw(-iutf8 -outf8 -JH -f));
print _e $a->get("éèª");
print _e $b->get("éèª");
print "-" x 80;
my $c = Text::Kakasi->new(qw(-iutf8 -outf8 -JH));
print _e $a->get("éèª");
print _e $b->get("éèª");
print _e $b->get("éèª");