r64054 - in /branches/upstream/libtext-csv-perl/current: Changes META.yml README lib/Text/CSV.pm lib/Text/CSV_PP.pm t/71_pp.t

carnil at users.alioth.debian.org carnil at users.alioth.debian.org
Wed Oct 20 14:11:35 UTC 2010


Author: carnil
Date: Wed Oct 20 14:11:17 2010
New Revision: 64054

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=64054
Log:
[svn-upgrade] new version libtext-csv-perl (1.20)

Modified:
    branches/upstream/libtext-csv-perl/current/Changes
    branches/upstream/libtext-csv-perl/current/META.yml
    branches/upstream/libtext-csv-perl/current/README
    branches/upstream/libtext-csv-perl/current/lib/Text/CSV.pm
    branches/upstream/libtext-csv-perl/current/lib/Text/CSV_PP.pm
    branches/upstream/libtext-csv-perl/current/t/71_pp.t

Modified: branches/upstream/libtext-csv-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtext-csv-perl/current/Changes?rev=64054&op=diff
==============================================================================
--- branches/upstream/libtext-csv-perl/current/Changes (original)
+++ branches/upstream/libtext-csv-perl/current/Changes Wed Oct 20 14:11:17 2010
@@ -1,4 +1,11 @@
 Revision history for Perl extension Text::CSV.
+
+1.20  Wed Oct 20 13:53:59 2010
+	- couldn't parse the csv containing the column starting with '0'. (hiratara)
+	    * patched by hiratara
+	    * enhanced getline regexp (makamaka)
+	    * resolved a bug in bleadperl-fb85c04
+	- added tests into t/71_pp.t (hiratara)
 
 1.19  Sat Oct  2 14:15:59 2010
 	- getline didn't work correctly with 0 or null containing lines

Modified: branches/upstream/libtext-csv-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtext-csv-perl/current/META.yml?rev=64054&op=diff
==============================================================================
--- branches/upstream/libtext-csv-perl/current/META.yml (original)
+++ branches/upstream/libtext-csv-perl/current/META.yml Wed Oct 20 14:11:17 2010
@@ -1,6 +1,6 @@
 --- #YAML:1.0
 name:               Text-CSV
-version:            1.19
+version:            1.20
 abstract:           comma-separated values manipulator (using XS or PurePerl)
 author:
     - Makamaka Hannyaharamitu, E<lt>makamaka[at]cpan.orgE<gt>

Modified: branches/upstream/libtext-csv-perl/current/README
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtext-csv-perl/current/README?rev=64054&op=diff
==============================================================================
--- branches/upstream/libtext-csv-perl/current/README (original)
+++ branches/upstream/libtext-csv-perl/current/README Wed Oct 20 14:11:17 2010
@@ -1,4 +1,4 @@
-Text::CSV version 1.19
+Text::CSV version 1.20
 ========================
 
 comma-separated values manipulator

Modified: branches/upstream/libtext-csv-perl/current/lib/Text/CSV.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtext-csv-perl/current/lib/Text/CSV.pm?rev=64054&op=diff
==============================================================================
--- branches/upstream/libtext-csv-perl/current/lib/Text/CSV.pm (original)
+++ branches/upstream/libtext-csv-perl/current/lib/Text/CSV.pm Wed Oct 20 14:11:17 2010
@@ -6,7 +6,7 @@
 use vars qw( $VERSION $DEBUG );
 
 BEGIN {
-    $VERSION = '1.19';
+    $VERSION = '1.20';
     $DEBUG   = 0;
 }
 
@@ -287,7 +287,7 @@
 
 =head1 VERSION
 
-    1.19
+    1.20
 
 This module is compatible with Text::CSV_XS B<0.74> and later.
 

Modified: branches/upstream/libtext-csv-perl/current/lib/Text/CSV_PP.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtext-csv-perl/current/lib/Text/CSV_PP.pm?rev=64054&op=diff
==============================================================================
--- branches/upstream/libtext-csv-perl/current/lib/Text/CSV_PP.pm (original)
+++ branches/upstream/libtext-csv-perl/current/lib/Text/CSV_PP.pm Wed Oct 20 14:11:17 2010
@@ -11,7 +11,7 @@
 use vars qw($VERSION);
 use Carp ();
 
-$VERSION = '1.27';
+$VERSION = '1.28';
 
 sub PV  { 0 }
 sub IV  { 1 }
@@ -640,7 +640,24 @@
             my $is_continued   = scalar(my @list = $line =~ /$re/g) % 2; # if line is valid, quot is even
 
             if ( $line =~ /${re}0/ ) { # null suspicion case
-                $is_continued = $line =~ /^($re(?:$re$re|${re}0|[^$re])+$re[^0])+$/  ? 0 : 1;
+                $is_continued = $line =~ qr/
+                    ^
+                    (
+                        (?:
+                            $re             # $quote
+                            (?:
+                                  $re$re    #    escaped $quote
+                                | ${re}0    # or escaped zero
+                                | [^$quot]  # or exceptions of $quote
+                            )*
+                            $re             # $quote
+                            [^0$quot]       # non zero or $quote
+                        )
+                        |                   
+                        (?:[^$quot]*)       # exceptions of $quote
+                    )+
+                    $
+                /x ? 0 : 1;
             }
 
             if ( $is_continued and !eof($io) ) {
@@ -979,7 +996,7 @@
 
 =head1 VERSION
 
-    1.27
+    1.28
 
 This module is compatible with Text::CSV_XS B<0.74> and later.
 

Modified: branches/upstream/libtext-csv-perl/current/t/71_pp.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtext-csv-perl/current/t/71_pp.t?rev=64054&op=diff
==============================================================================
--- branches/upstream/libtext-csv-perl/current/t/71_pp.t (original)
+++ branches/upstream/libtext-csv-perl/current/t/71_pp.t Wed Oct 20 14:11:17 2010
@@ -5,7 +5,7 @@
 use strict;
 $^W = 1;
 
-use Test::More tests => 58;
+use Test::More tests => 88;
 
 
 BEGIN { $ENV{PERL_TEXT_CSV} = $ARGV[0] || 0; }
@@ -182,6 +182,7 @@
     binmode FH;
 
     ok( $csv->print( *FH, [ 0, qq{t"t"\n} ] ) );
+
     close( FH );
 
     open( FH, "__test.csv" ) or die $!;
@@ -195,3 +196,109 @@
 
     unlink( '__test.csv' );
 }
+
+
+# 2010-10-13 reported by hiratara
+{
+    $csv = Text::CSV->new ({ binary => 1, eol => $/, always_quote => 1 });
+
+    open( FH, '>__test.csv' ) or die $!;
+    binmode FH;
+
+    ok( $csv->print( *FH, [qw/A 01/] ) );
+    ok( $csv->print( *FH, [qw/B 02/] ) );
+    close( FH );
+
+    open( FH, "__test.csv" ) or die $!;
+    binmode FH;
+
+    my $col = $csv->getline( *FH );
+
+    is( $col->[0], 'A' );
+    is( $col->[1], '01' );
+
+    $col = $csv->getline( *FH );
+
+    is( $col->[0], 'B' );
+    is( $col->[1], '02' );
+    close( FH );
+
+    unlink( '__test.csv' );
+}
+
+
+# 2010-10-13 reported(2) by hiratara
+{
+    $csv = Text::CSV->new ({ binary => 1, eol => $/ });
+
+    open( FH, '>__test.csv' ) or die $!;
+    binmode FH;
+
+    ok( $csv->print( *FH, [qw/1 0"/] ) );
+    ok( $csv->print( *FH, [qw/2 0"/] ) );
+    close( FH );
+
+    open( FH, "__test.csv" ) or die $!;
+    binmode FH;
+
+    my $col = $csv->getline( *FH );
+
+    is( $col->[0], '1' );
+    is( $col->[1], '0"' );
+
+    $col = $csv->getline( *FH );
+
+    is( $col->[0], '2' );
+    is( $col->[1], '0"' );
+
+    close( FH );
+
+    unlink( '__test.csv' );
+}
+
+
+{ # previous three test merged
+    $csv = Text::CSV->new ({ binary => 1, eol => $/ });
+
+    open( FH, '>__test.csv' ) or die $!;
+    binmode FH;
+
+    ok( $csv->print( *FH, [ 0, qq{t"t"\n} ] ) );
+    ok( $csv->print( *FH, [qw/A 01/] ) );
+    ok( $csv->print( *FH, [qw/1 0"/] ) );
+    ok( $csv->print( *FH, [undef,undef] ) );
+    ok( $csv->print( *FH, [qw/1 0"/] ) );
+    ok( $csv->print( *FH, [qw/A 01/] ) );
+    close( FH );
+
+    open( FH, "__test.csv" ) or die $!;
+    binmode FH;
+
+    my $col = $csv->getline( *FH );
+    is( $col->[0], "0" );
+    is( $col->[1], qq{t"t"\n} );
+
+    $col = $csv->getline( *FH );
+    is( $col->[0], 'A' );
+    is( $col->[1], '01' );
+
+    $col = $csv->getline( *FH );
+    is( $col->[0], '1' );
+    is( $col->[1], '0"' );
+
+    $col = $csv->getline( *FH );
+    is( $col->[0], '' );
+    is( $col->[1], '' );
+
+    $col = $csv->getline( *FH );
+    is( $col->[0], '1' );
+    is( $col->[1], '0"' );
+
+    $col = $csv->getline( *FH );
+    is( $col->[0], 'A' );
+    is( $col->[1], '01' );
+    close( FH );
+
+    unlink( '__test.csv' );
+}
+




More information about the Pkg-perl-cvs-commits mailing list