GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  DATA::VISITOR::ENCODE (3)

.ds Aq ’

NAME

Data::Visitor::Encode - Encode/Decode Values In A Structure (DEPRECATED)

CONTENTS

SYNOPSIS



  # THIS MODULE IS NOW DEPRECATED. Use Data::Recursive::Encode instead
  use Data::Visitor::Encode;

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



DEPRECATION ALERT

This module has been DEPRECATED in favor of Data::Recursive::Encode. Bug reports will not be acted upon, and the module will cease to exist from CPAN by the end of year 2011.

You’ve been warned (since 2009)

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.

Starting from 0.09000, you can directly use the methods without instantiating the object:



  Data::Visitor::Encode->encode(euc-jp, $obj);
  # instead of Data::Visitor::Encode->new->encod(euc-jp, $obj)



METHODS

    utf8_on



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



Returns a structure containing nodes with utf8 flag on

    utf8_off



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



Returns a structure containing nodes with utf8 flag off

    encode



  $dev->encode($encoding, \%hash   [, CHECK]);
  $dev->encode($encoding, \@list   [, CHECK]);
  $dev->encode($encoding, \$scalar [, CHECK]);
  $dev->encode($encoding, $scalar  [, CHECK]);
  $dev->encode($encoding, $object  [, CHECK]);



Returns a structure containing nodes which are encoded in the specified encoding.

    decode



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



Returns a structure containing nodes which are decoded from the specified encoding.

    decode_utf8



  $dev->decode_utf8(\%hash);
  $dev->decode_utf8(\@list);
  $dev->decode_utf8(\$scalar);
  $dev->decode_utf8($scalar);
  $dev->decode_utf8($object);



Returns a structure containing nodes which have been processed through decode_utf8.

    encode_utf8



  $dev->encode_utf8(\%hash);
  $dev->encode_utf8(\@list);
  $dev->encode_utf8(\$scalar);
  $dev->encode_utf8($scalar);
  $dev->encode_utf8($object);



Returns a structure containing nodes which have been processed through encode_utf8.

    h2z

    z2h



  $dev->h2z($encoding, \%hash);
  $dev->h2z($encoding, \@list);
  $dev->h2z($encoding, \$scalar);
  $dev->h2z($encoding, $scalar);
  $dev->h2z($encoding, $object);



h2z and z2h are Japanese-only methods (hey, I’m a little biased like that). They perform the task of mapping half-width katakana to full-width katakana and vice-versa.

These methods use Encode::JP::H2Z, which requires us to go from the original encoding to euc-jp and then back. There are other modules that are built to handle exactly this problem, which may come out to be faster than using Encode.pm’s somewhat hidden Encode::JP::H2Z, but I really don’t care for adding another dependency to this module other than Encode.pm, so here it is.

If you’re significantly worried about performance, I’ll gladly accept patches as long as there are no prerequisite modules or the prerequisite is optional.

    decode_utf8



  $dev->decode_utf8(\%hash);
  $dev->decode_utf8(\@list);
  $dev->decode_utf8(\$scalar);
  $dev->decode_utf8($scalar);
  $dev->decode_utf8($object);



Returns a structure containing nodes which have been processed through decode_utf8.

    encode_utf8



  $dev->encode_utf8(\%hash);
  $dev->encode_utf8(\@list);
  $dev->encode_utf8(\$scalar);
  $dev->encode_utf8($scalar);
  $dev->encode_utf8($object);



Returns a structure containing nodes which have been processed through encode_utf8.

    do_decode

    do_encode

    do_utf8_off

    do_utf8_on

    do_h2z

    do_z2h

    do_encode_utf8

    do_decode_utf8

    visit_glob

    visit_hash

    visit_object

    visit_scalar

    visit_value

These methods are private. Only use if it you are subclassing this class.

AUTHOR

Copyright (c) 2007 Daisuke Maki <daisuke@endeworks.jp>

SEE ALSO

Data::Visitor, Encode

LICENSE

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

See http://www.perl.com/perl/misc/Artistic.html

Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 DATA::VISITOR::ENCODE (3) 2011-07-06

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.