r57337 - in /branches/upstream/libtext-csv-encoded-perl/current: ./ lib/Text/CSV/ lib/Text/CSV/Encoded/Coder/ t/ t/tests/
gregoa at users.alioth.debian.org
gregoa at users.alioth.debian.org
Sun May 2 16:46:45 UTC 2010
Author: gregoa
Date: Sun May 2 16:46:35 2010
New Revision: 57337
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=57337
Log:
[svn-upgrade] Integrating new upstream version, libtext-csv-encoded-perl (0.10)
Added:
branches/upstream/libtext-csv-encoded-perl/current/t/pp_07_coder_check_value.t
branches/upstream/libtext-csv-encoded-perl/current/t/tests/07_coder_check_value_euc-jp.t
Modified:
branches/upstream/libtext-csv-encoded-perl/current/Changes
branches/upstream/libtext-csv-encoded-perl/current/MANIFEST
branches/upstream/libtext-csv-encoded-perl/current/META.yml
branches/upstream/libtext-csv-encoded-perl/current/Makefile.PL
branches/upstream/libtext-csv-encoded-perl/current/README
branches/upstream/libtext-csv-encoded-perl/current/lib/Text/CSV/Encoded.pm
branches/upstream/libtext-csv-encoded-perl/current/lib/Text/CSV/Encoded/Coder/Base.pm
branches/upstream/libtext-csv-encoded-perl/current/lib/Text/CSV/Encoded/Coder/Encode.pm
branches/upstream/libtext-csv-encoded-perl/current/lib/Text/CSV/Encoded/Coder/EncodeGuess.pm
Modified: branches/upstream/libtext-csv-encoded-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtext-csv-encoded-perl/current/Changes?rev=57337&op=diff
==============================================================================
--- branches/upstream/libtext-csv-encoded-perl/current/Changes (original)
+++ branches/upstream/libtext-csv-encoded-perl/current/Changes Sun May 2 16:46:35 2010
@@ -1,4 +1,10 @@
Revision history for Perl extension Text::CSV::Encoded.
+
+0.10 Mon Apr 26 17:41:12 2010
+ [Text::CSV::Encoded::Coder::*]
+ - coder class can accept check value.
+ ex. $csv->coder->encode_check_value( Encode::FB_PERLQQ );
+ $csv->coder->decode_check_value( Encode::FB_PERLQQ );
0.09 Fri Oct 9 16:56:43 2009
- requires Text::CSV 1.12 or later.
Modified: branches/upstream/libtext-csv-encoded-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtext-csv-encoded-perl/current/MANIFEST?rev=57337&op=diff
==============================================================================
--- branches/upstream/libtext-csv-encoded-perl/current/MANIFEST (original)
+++ branches/upstream/libtext-csv-encoded-perl/current/MANIFEST Sun May 2 16:46:35 2010
@@ -1,38 +1,33 @@
Changes
-Makefile.PL
-MANIFEST
-README
-
lib/Text/CSV/Encoded.pm
lib/Text/CSV/Encoded/Coder/Base.pm
lib/Text/CSV/Encoded/Coder/Encode.pm
lib/Text/CSV/Encoded/Coder/EncodeGuess.pm
-
-t/00_pod.t Check if pod is valid
-t/01_use.t
-t/02_undef.t
-t/03_attr_err.t
-
+Makefile.PL
+MANIFEST
+META.yml Module meta-data (added by MakeMaker)
+README
+sample/sjis.csv
+sample/utf8.csv
+t/00_pod.t Check if pod is valid
+t/01_use.t
+t/02_undef.t
+t/03_attr_err.t
+t/_setup.pm
t/pp_01_base.t
t/pp_02_code.t
t/pp_03_file.t
t/pp_04_uni_but_utf8.t
t/pp_05_guess.t
t/pp_06_coder_class.t
-t/xs_01_base.t
-t/xs_02_code.t
-t/xs_03_file.t
-
+t/pp_07_coder_check_value.t
t/tests/01_base.t
t/tests/02_code.t
t/tests/03_file.t
t/tests/04_uni_but_utf8.t
t/tests/05_guess.t
t/tests/06_coder_class.t
-
-t/_setup.pm
-
-sample/sjis.csv
-sample/utf8.csv
-
-META.yml Module meta-data (added by MakeMaker)
+t/tests/07_coder_check_value_euc-jp.t
+t/xs_01_base.t
+t/xs_02_code.t
+t/xs_03_file.t
Modified: branches/upstream/libtext-csv-encoded-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtext-csv-encoded-perl/current/META.yml?rev=57337&op=diff
==============================================================================
--- branches/upstream/libtext-csv-encoded-perl/current/META.yml (original)
+++ branches/upstream/libtext-csv-encoded-perl/current/META.yml Sun May 2 16:46:35 2010
@@ -1,6 +1,6 @@
--- #YAML:1.0
name: Text-CSV-Encoded
-version: 0.09
+version: 0.10
abstract: Encoding aware Text::CSV.
author:
- Makamaka Hannyaharamitu, E<lt>makamaka[at]cpan.orgE<gt>
@@ -8,16 +8,20 @@
distribution_type: module
configure_requires:
ExtUtils::MakeMaker: 0
+build_requires:
+ ExtUtils::MakeMaker: 0
requires:
IO::Handle: 0
Test::Harness: 0
Test::More: 0
Text::CSV: 1.12
+resources:
+ repository: http://github.com/makamaka/Text-CSV-Encoded
no_index:
directory:
- t
- inc
-generated_by: ExtUtils::MakeMaker version 6.48
+generated_by: ExtUtils::MakeMaker version 6.54
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
version: 1.4
Modified: branches/upstream/libtext-csv-encoded-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtext-csv-encoded-perl/current/Makefile.PL?rev=57337&op=diff
==============================================================================
--- branches/upstream/libtext-csv-encoded-perl/current/Makefile.PL (original)
+++ branches/upstream/libtext-csv-encoded-perl/current/Makefile.PL Sun May 2 16:46:35 2010
@@ -18,5 +18,14 @@
($] >= 5.005 ? ## Add these new keywords supported since 5.005
(ABSTRACT_FROM => 'lib/Text/CSV/Encoded.pm', # retrieve abstract from module
AUTHOR => 'Makamaka Hannyaharamitu, E<lt>makamaka[at]cpan.orgE<gt>') : ()),
+
( $ExtUtils::MakeMaker::VERSION >= 6.3002 ? ('LICENSE' => 'perl', ) : () ),
+
+ ( $ExtUtils::MakeMaker::VERSION >= 6.46 ? (
+ 'META_MERGE' => {
+ resources => {
+ repository => 'http://github.com/makamaka/Text-CSV-Encoded',
+ },
+ } ) : ()
+ ),
);
Modified: branches/upstream/libtext-csv-encoded-perl/current/README
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtext-csv-encoded-perl/current/README?rev=57337&op=diff
==============================================================================
--- branches/upstream/libtext-csv-encoded-perl/current/README (original)
+++ branches/upstream/libtext-csv-encoded-perl/current/README Sun May 2 16:46:35 2010
@@ -1,7 +1,7 @@
Text::CSV::Encoded
========================
-Encoding aware Text::CSV
+encoding-handling Text::CSV
INSTALLATION
Modified: branches/upstream/libtext-csv-encoded-perl/current/lib/Text/CSV/Encoded.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtext-csv-encoded-perl/current/lib/Text/CSV/Encoded.pm?rev=57337&op=diff
==============================================================================
--- branches/upstream/libtext-csv-encoded-perl/current/lib/Text/CSV/Encoded.pm (original)
+++ branches/upstream/libtext-csv-encoded-perl/current/lib/Text/CSV/Encoded.pm Sun May 2 16:46:35 2010
@@ -4,7 +4,7 @@
use vars qw( $VERSION );
use Carp ();
-$VERSION = '0.09';
+$VERSION = '0.10';
BEGIN {
require Text::CSV;
@@ -290,6 +290,10 @@
$uni_columns = $csv->decode( 'euc-jp', $line ); # euc-jp => unicode
$line = $csv->encode( 'euc-jp', $uni_columns ); # unicode => euc-jp
+ # pass check value to coder class
+ $csv->coder->encode_check_value( Encode::FB_PERLQQ );
+
+
=head1 DESCRIPTION
This module inherits L<Text::CSV> and is aware of input/output encodings.
@@ -627,7 +631,7 @@
=head1 COPYRIGHT AND LICENSE
-Copyright 2008-2009 by Makamaka Hannyaharamitu
+Copyright 2008-2010 by Makamaka Hannyaharamitu
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.
Modified: branches/upstream/libtext-csv-encoded-perl/current/lib/Text/CSV/Encoded/Coder/Base.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtext-csv-encoded-perl/current/lib/Text/CSV/Encoded/Coder/Base.pm?rev=57337&op=diff
==============================================================================
--- branches/upstream/libtext-csv-encoded-perl/current/lib/Text/CSV/Encoded/Coder/Base.pm (original)
+++ branches/upstream/libtext-csv-encoded-perl/current/lib/Text/CSV/Encoded/Coder/Base.pm Sun May 2 16:46:35 2010
@@ -3,7 +3,7 @@
use strict;
BEGIN {
- $Text::CSV::Encoded::Coder::Base::VERSION = '0.01';
+ $Text::CSV::Encoded::Coder::Base::VERSION = '0.02';
}
sub new {
@@ -37,6 +37,18 @@
}
+sub encode_check_value {
+ $_[0]->{ encode_check_value } = $_[1] if @_ > 1;
+ $_[0]->{ encode_check_value } || 0;
+}
+
+
+sub decode_check_value {
+ $_[0]->{ decode_check_value } = $_[1] if @_ > 1;
+ $_[0]->{ decode_check_value } || 0;
+}
+
+
1;
__END__
@@ -120,6 +132,18 @@
In Perl 5.8 or later, it is expected to do C<utf8::upgrade> against $str.
In older versions, this method may be meaningless and there is no need to implement.
See to L<utf8>.
+
+=head2 encode_check_value
+
+Setter/Getter for an argument passing to encode.
+
+ $coder->encode_check_value( Encode::FB_PERLQQ );
+
+=head2 decode_check_value
+
+Setter/Getter for an argument passing to decode.
+
+ $coder->encode_check_value( Encode::FB_PERLQQ );
=head1 EXAMPLE
@@ -179,7 +203,7 @@
=head1 COPYRIGHT AND LICENSE
-Copyright 2008 by Makamaka Hannyaharamitu
+Copyright 2008-2010 by Makamaka Hannyaharamitu
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.
Modified: branches/upstream/libtext-csv-encoded-perl/current/lib/Text/CSV/Encoded/Coder/Encode.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtext-csv-encoded-perl/current/lib/Text/CSV/Encoded/Coder/Encode.pm?rev=57337&op=diff
==============================================================================
--- branches/upstream/libtext-csv-encoded-perl/current/lib/Text/CSV/Encoded/Coder/Encode.pm (original)
+++ branches/upstream/libtext-csv-encoded-perl/current/lib/Text/CSV/Encoded/Coder/Encode.pm Sun May 2 16:46:35 2010
@@ -9,7 +9,7 @@
use Carp ();
use Encode ();
-our $VERSION = '0.03';
+our $VERSION = '0.04';
my %EncoderCache;
@@ -22,14 +22,14 @@
sub encode {
my ( $self, $encoding, $str ) = @_;
return undef unless defined $str;
- $self->find_encoding( $encoding )->encode( $str );
+ $self->find_encoding( $encoding )->encode( $str, $self->encode_check_value );
}
sub decode {
my ( $self, $encoding, $str ) = @_;
return undef unless defined $str;
- $self->find_encoding( $encoding )->decode( $str );
+ $self->find_encoding( $encoding )->decode( $str, $self->decode_check_value );
}
@@ -37,7 +37,7 @@
my ( $self, $encoding, $arrayref ) = @_;
my $enc = $self->find_encoding( $encoding ) || return;
for ( @$arrayref ) {
- $_ = $enc->decode( $_ ) if defined $_;
+ $_ = $enc->decode( $_, $self->decode_check_value ) if defined $_;
}
}
@@ -46,7 +46,7 @@
my ( $self, $encoding, $arrayref ) = @_;
my $enc = $self->find_encoding( $encoding ) || return;
for ( @$arrayref ) {
- $_ = $enc->encode( $_ ) if defined $_;
+ $_ = $enc->encode( $_, $self->encode_check_value ) if defined $_;
}
}
@@ -87,7 +87,7 @@
=head1 COPYRIGHT AND LICENSE
-Copyright 2008-2009 by Makamaka Hannyaharamitu
+Copyright 2008-2010 by Makamaka Hannyaharamitu
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.
Modified: branches/upstream/libtext-csv-encoded-perl/current/lib/Text/CSV/Encoded/Coder/EncodeGuess.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtext-csv-encoded-perl/current/lib/Text/CSV/Encoded/Coder/EncodeGuess.pm?rev=57337&op=diff
==============================================================================
--- branches/upstream/libtext-csv-encoded-perl/current/lib/Text/CSV/Encoded/Coder/EncodeGuess.pm (original)
+++ branches/upstream/libtext-csv-encoded-perl/current/lib/Text/CSV/Encoded/Coder/EncodeGuess.pm Sun May 2 16:46:35 2010
@@ -10,7 +10,7 @@
use Encode ();
use Encode::Guess;
-our $VERSION = '0.02';
+our $VERSION = '0.03';
sub decode {
@@ -21,10 +21,10 @@
if ( ref $encoding ) {
my $enc = Encode::Guess::guess_encoding( $str, @$encoding );
$enc = $self->find_encoding( $encoding->[0] ) unless ref $enc;
- return $enc->decode( $str );
+ return $enc->decode( $str, $self->decode_check_value );
}
- $self->find_encoding( $encoding )->decode( $str );
+ $self->find_encoding( $encoding )->decode( $str, $self->decode_check_value );
}
@@ -35,13 +35,13 @@
for ( @$arrayref ) {
my $enc = Encode::Guess::guess_encoding( $_, @$encoding );
$enc = $self->find_encoding( $encoding->[0] ) unless ref $enc;
- $_ = $enc->decode( $_ );
+ $_ = $enc->decode( $_, $self->decode_check_value );
}
}
else {
my $enc = $self->find_encoding( $encoding ) || return;
for ( @$arrayref ) {
- $_ = $enc->decode( $_ );
+ $_ = $enc->decode( $_, $self->decode_check_value );
}
}
@@ -128,7 +128,7 @@
=head1 COPYRIGHT AND LICENSE
-Copyright 2008 by Makamaka Hannyaharamitu
+Copyright 2008-2010 by Makamaka Hannyaharamitu
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.
Added: branches/upstream/libtext-csv-encoded-perl/current/t/pp_07_coder_check_value.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtext-csv-encoded-perl/current/t/pp_07_coder_check_value.t?rev=57337&op=file
==============================================================================
--- branches/upstream/libtext-csv-encoded-perl/current/t/pp_07_coder_check_value.t (added)
+++ branches/upstream/libtext-csv-encoded-perl/current/t/pp_07_coder_check_value.t Sun May 2 16:46:35 2010
@@ -1,0 +1,15 @@
+
+use strict;
+use Test::More;
+
+use lib qw(./t);
+use _setup;
+
+BEGIN {
+ _setup->tests(2);
+}
+
+require './t/tests/07_coder_check_value_euc-jp.t';
+
+
+__END__
Added: branches/upstream/libtext-csv-encoded-perl/current/t/tests/07_coder_check_value_euc-jp.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtext-csv-encoded-perl/current/t/tests/07_coder_check_value_euc-jp.t?rev=57337&op=file
==============================================================================
--- branches/upstream/libtext-csv-encoded-perl/current/t/tests/07_coder_check_value_euc-jp.t (added)
+++ branches/upstream/libtext-csv-encoded-perl/current/t/tests/07_coder_check_value_euc-jp.t Sun May 2 16:46:35 2010
@@ -1,0 +1,35 @@
+#!/usr/bin/perl -w
+
+# This file is encoded in EUC-JP, and output is Shift_JIS.
+# ¤³¤Î¥Õ¥¡¥¤¥ë¤Î¥¨¥ó¥³¡¼¥Ç¥£¥ó¥°¤ÏEUC-JP¡¢½ÐÎϤÏShift_JIS¡£
+
+use strict;
+
+BEGIN {
+ local $ENV{PERL_TEXT_CSV} = $ARGV[0] || 0;
+ require Text::CSV::Encoded;
+}
+
+
+use Encode;
+
+my $str = '¤¢,¤¤,¡Á,¡';
+my $check = encode( 'shiftjis', decode( 'euc-jp', '"¤¢","¤¤","¡Á",' ) );
+
+my @cols;
+my $csv = Text::CSV::Encoded->new( { encoding_in => 'euc-jp', encoding_out => 'shiftjis' } );
+
+$csv->parse( $str );
+ at cols = $csv->fields;
+$csv->combine( @cols );
+is( $csv->string, $check . '"?"' );
+
+# change check value
+$csv->coder->encode_check_value( Encode::FB_PERLQQ );
+
+$csv->parse( $str );
+ at cols = $csv->fields;
+$csv->combine( @cols );
+is( $csv->string, $check . '"\x{2460}"' );
+
+1;
More information about the Pkg-perl-cvs-commits
mailing list