NAME

Data::Visitor::Encode - Encode/Decode Values In A Structure

SYNOPSIS

use Data::Visitor::Encode;

my $ev = Data::Visitor::Encode->new();
my %hash = (...); # assume data is in Perl native Unicode
$ev->encode('euc-jp', \%hash); # now strings are in euc-jp
$ev->decode('euc-jp', \%hash); # now strings are back in unicode
$ev->utf8_on(\%hash);
$ev->utf8_off(\%hash);

DESCRIPTION

Data::Visitor::Encode visits each node of a structure, and returns a new structure with each node's encoding (or similar action). If you ever wished to do a bulk encode/decode of the contents of a structure, then this module may help you.

METHODS

utf8_on

$ev->utf8_on(\%hash);
$ev->utf8_on(\@list);
$ev->utf8_on(\$scalar);
$ev->utf8_on($scalar);

Returns a structure containing nodes with utf8 flag on

utf8_off

$ev->utf8_off(\%hash);
$ev->utf8_off(\@list);
$ev->utf8_off(\$scalar);
$ev->utf8_off($scalar);

Returns a structure containing nodes with utf8 flag off

encode

$ev->encode($encoding, \%hash);
$ev->encode($encoding, \@list);
$ev->encode($encoding, \$scalar);
$ev->encode($encoding, $scalar);

Returns a stricture contains nodes which are encoded in the specified encoding.

decode

$ev->decode($encoding, \%hash);
$ev->decode($encoding, \@list);
$ev->decode($encoding, \$scalar);
$ev->decode($encoding, $scalar);

Returns a stricture contains nodes which are decoded from the specified encoding.

AUTHOR

Daisuke Maki <daisuke@endeworks.jp<gt>

SEE ALSO

Data::Visitor, Encode