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
Text::CSV::Encoded::Coder::Base(3) User Contributed Perl Documentation Text::CSV::Encoded::Coder::Base(3)

Text::CSV::Encoded::Coder::Base - Interface for Text::CSV::Encoded coder base class

version 0.25

    package Text::CSV::Encoded::Coder::YourCoder;

    use base qw( Text::CSV::Encoded::Coder::Base );

    sub decode {
        ...
    }

    sub encode {
        ...
    }

    sub upgrade {
        ...
    }

    sub decode_fields_ref {
        ...
    }

    sub encode_fields_ref {
        ...
    }

This module is used by Text::CSV::Encoded internally.

    ( $self, $encoding, $str ) = @_;
    ....
    return $decoded_str;

Takes an encoding and a CSV string. It must return a Perl string decoded in $encoding. In Perl 5.8 or later, if $enc is "undef" or false, the encoding should be utf8.

    ( $self, $encoding, $str ) = @_;
    ....
    return $encoded_str;

Takes an encoding and a Perl string. It must return a CSV string encoded in $encoding. In Perl 5.8 or later, if $enc is "undef" or false, the encoding should be utf8.

    ( $self, $encoding, $arrayref ) = @_;

Takes an encoding and an array reference. It must decoded each array entries in $encoding.

    ( $self, $encoding, $arrayref ) = @_;

Takes an encoding and an array reference. It must encoded each array entries in $encoding.

    ( $self, $str ) = @_;

In Perl 5.8 or later, it is expected to do "utf8::upgrade" against $str. In older versions, this method may be meaningless and there is no need to implement. See to utf8.

Setter/Getter for an argument passing to encode.

    $coder->encode_check_value( Encode::FB_PERLQQ );

Setter/Getter for an argument passing to decode.

    $coder->encode_check_value( Encode::FB_PERLQQ );

Use with Jcode.

    package Text::CSV::Encoded::Coder::Jcode;
    
    use strict;
    use base qw( Text::CSV::Encoded::Coder::Base );
    
    use Jcode ();
    
    my $Jcode = Jcode->new;
    
    my %alias = (
        'shiftjis' => 'sjis',
        'euc-jp'   => 'euc',
        'sjis'     => 'sjis',
        'euc'      => 'euc',
    );
    
    
    sub decode {
        my ( $self, $encoding, $str ) = @_;
        my $enc = $alias{ $encoding };
        $Jcode->set( $str, $enc )->euc;
    }
    
    
    sub encode {
        my ( $self, $encoding, $str ) = @_;
        my $enc = $alias{ $encoding };
        $Jcode->set( $str, 'euc' )->$enc();
    }
    
    
    sub decode_fields_ref {
        my ( $self, $encoding, $arrayref ) = @_;
        my $enc = $alias{ $encoding };
        for ( @$arrayref ) {
            $_ = $Jcode->set( $_, $enc )->euc;
        }
    }
    
    
    sub encode_fields_ref {
        my ( $self, $encoding, $arrayref ) = @_;
        my $enc = $alias{ $encoding };
        for ( @$arrayref ) {
            $_ = $Jcode->set( $_, 'euc' )->$enc();
        }
    }

Makamaka Hannyaharamitu, <makamaka[at]cpan.org>

Copyright 2008-2013 by Makamaka Hannyaharamitu

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

2016-01-28 perl v5.32.1

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

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