r45923 - in /trunk/libtext-csv-perl: Changes META.yml README debian/changelog debian/control debian/copyright lib/Text/CSV.pm lib/Text/CSV_PP.pm t/45_eol.t t/65_allow.t

jawnsy-guest at users.alioth.debian.org jawnsy-guest at users.alioth.debian.org
Sat Oct 17 15:18:54 UTC 2009


Author: jawnsy-guest
Date: Sat Oct 17 15:18:38 2009
New Revision: 45923

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=45923
Log:
* New upstream release
* Refreshed copyright information
* Added myself to Copyright and Uploaders
* Rewrote control description
* Now recommends the new version of the XS implementation
* Drop version dependency on perl

Modified:
    trunk/libtext-csv-perl/Changes
    trunk/libtext-csv-perl/META.yml
    trunk/libtext-csv-perl/README
    trunk/libtext-csv-perl/debian/changelog
    trunk/libtext-csv-perl/debian/control
    trunk/libtext-csv-perl/debian/copyright
    trunk/libtext-csv-perl/lib/Text/CSV.pm
    trunk/libtext-csv-perl/lib/Text/CSV_PP.pm
    trunk/libtext-csv-perl/t/45_eol.t
    trunk/libtext-csv-perl/t/65_allow.t

Modified: trunk/libtext-csv-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtext-csv-perl/Changes?rev=45923&op=diff
==============================================================================
--- trunk/libtext-csv-perl/Changes (original)
+++ trunk/libtext-csv-perl/Changes Sat Oct 17 15:18:38 2009
@@ -1,4 +1,9 @@
 Revision history for Perl extension Text::CSV.
+
+1.15  Thu Oct 15 17:23:39 2009
+	- updated the compatibility for Text::CSV_XS version 0.69
+	    * Auto detection of eol => "\r" in streams
+	       (but incomplete correspondence. I will rewrite CSV_PP in the future)
 
 1.14  Thu Oct  8 15:02:24 2009
 	- updated the compatibility for Text::CSV_XS version 0.68

Modified: trunk/libtext-csv-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtext-csv-perl/META.yml?rev=45923&op=diff
==============================================================================
--- trunk/libtext-csv-perl/META.yml (original)
+++ trunk/libtext-csv-perl/META.yml Sat Oct 17 15:18:38 2009
@@ -1,6 +1,6 @@
 --- #YAML:1.0
 name:               Text-CSV
-version:            1.14
+version:            1.15
 abstract:           comma-separated values manipulator (using XS or PurePerl)
 author:
     - Makamaka Hannyaharamitu, E<lt>makamaka[at]cpan.orgE<gt>

Modified: trunk/libtext-csv-perl/README
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtext-csv-perl/README?rev=45923&op=diff
==============================================================================
--- trunk/libtext-csv-perl/README (original)
+++ trunk/libtext-csv-perl/README Sat Oct 17 15:18:38 2009
@@ -1,4 +1,4 @@
-Text::CSV version 1.13
+Text::CSV version 1.15
 ========================
 
 comma-separated values manipulator

Modified: trunk/libtext-csv-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtext-csv-perl/debian/changelog?rev=45923&op=diff
==============================================================================
--- trunk/libtext-csv-perl/debian/changelog (original)
+++ trunk/libtext-csv-perl/debian/changelog Sat Oct 17 15:18:38 2009
@@ -1,3 +1,14 @@
+libtext-csv-perl (1.15-1) UNRELEASED; urgency=low
+
+  * New upstream release
+  * Refreshed copyright information
+  * Added myself to Copyright and Uploaders
+  * Rewrote control description
+  * Now recommends the new version of the XS implementation
+  * Drop version dependency on perl
+
+ -- Jonathan Yu <jawnsy at cpan.org>  Sat, 17 Oct 2009 06:33:36 -0400
+
 libtext-csv-perl (1.14-1) unstable; urgency=low
 
   [ Brian Cassidy ]

Modified: trunk/libtext-csv-perl/debian/control
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtext-csv-perl/debian/control?rev=45923&op=diff
==============================================================================
--- trunk/libtext-csv-perl/debian/control (original)
+++ trunk/libtext-csv-perl/debian/control Sat Oct 17 15:18:38 2009
@@ -2,11 +2,11 @@
 Section: perl
 Priority: optional
 Build-Depends: debhelper (>= 7)
-Build-Depends-Indep: perl (>= 5.6.10-12), libtest-pod-perl
+Build-Depends-Indep: perl, libtest-pod-perl
 Maintainer: Debian Perl Group <pkg-perl-maintainers at lists.alioth.debian.org>
 Uploaders: Vincent Danjean <vdanjean at debian.org>,
  gregor herrmann <gregoa at debian.org>, Ansgar Burchardt <ansgar at 43-1.org>,
- Brian Cassidy <brian.cassidy at gmail.com>
+ Brian Cassidy <brian.cassidy at gmail.com>, Jonathan Yu <jawnsy at cpan.org>
 Standards-Version: 3.8.3
 Homepage: http://search.cpan.org/dist/Text-CSV/
 Vcs-Svn: svn://svn.debian.org/pkg-perl/trunk/libtext-csv-perl/
@@ -15,16 +15,16 @@
 Package: libtext-csv-perl
 Architecture: all
 Depends: ${perl:Depends}, ${misc:Depends}
-Recommends: libtext-csv-xs-perl (>= 0.68)
+Recommends: libtext-csv-xs-perl (>= 0.69)
 Description: comma-separated values manipulator (using XS or PurePerl)
- Text::CSV provides facilities for the composition and decomposition of
- comma-separated values. An instance of the Text::CSV class can combine
- fields into a CSV string and parse a CSV string into fields.
+ Text::CSV provides facilities for the composition and decomposition of files
+ containing comma-separated value records. An instance of the Text::CSV class
+ can combine fields into a CSV string and parse a CSV string into fields.
  .
  The module accepts either strings or files as input and can utilize any
  user-specified characters as delimiters, separators, and escapes so it is
  perhaps better called ASV (anything separated values) rather than just CSV.
  .
- To work, Text::CSV can use either Text::CSV_PP (a Pure Perl module present in
- this package) or Text::CSV_XS (a XS module, thus optimised, provided by the
- libtext-csv-xs-perl package).
+ This module will automatically select the best available implementation of
+ the algorithm, whether the Pure Perl version present in this package, or the
+ C/XS implementation, available in libtext-csv-xs-perl.

Modified: trunk/libtext-csv-perl/debian/copyright
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtext-csv-perl/debian/copyright?rev=45923&op=diff
==============================================================================
--- trunk/libtext-csv-perl/debian/copyright (original)
+++ trunk/libtext-csv-perl/debian/copyright Sat Oct 17 15:18:38 2009
@@ -1,26 +1,38 @@
-Format-Specification: http://wiki.debian.org/Proposals/CopyrightFormat?action=recall&rev=226
+Format-Specification:
+    http://wiki.debian.org/Proposals/CopyrightFormat?action=recall&rev=196
+Upstream-Maintainer: Makamaka Hannyaharamitu <makamaka at cpan.org>
+Upstream-Source: http://search.cpan.org/dist/Text-CSV/
 Upstream-Name: Text-CSV
-Upstream-Maintainer: Makamaka Hannyaharamitu
-Upstream-Source: http://search.cpan.org/dist/Text-CSV/
 
 Files: *
-Copyright: © 1997, Alan Citterman. All rights reserved.
-           © 2007-2009 Makamaka Hannyaharamitu. All rights reserved.
+Copyright: 2007-2009, Makamaka Hannyaharamitu <makamaka at cpan.org>
+ 1997, Alan Citterman <alan at mfgrtl.com>
+License-Alias: Perl
 License: GPL-1+ | Artistic
- This library is free software; you can redistribute it and/or modify it
- under the same terms as Perl itself.
- .
- Perl is distributed under the GNU General Public License, either version 1 or
- (at your option) any later version, and the Artistic License.
- .
- On Debian systems, the complete text of the GNU General Public License can be
- found in /usr/share/common-licenses/GPL and the Artistic License in
- /usr/share/common-licenses/Artistic.
+
+Files: lib/Text/CSV_PP.pm
+Copyright: 2005-2009, Makamaka Hannyaharamitu <makamaka at cpan.org>
+License: GPL-1+ | Artistic
 
 Files: debian/*
-Copyright: © 2008, Vincent Danjean <vdanjean at debian.org>
- © 2009, Brian Cassidy <brian.cassidy at gmail.com>
+Copyright: 2009, Jonathan Yu <jawnsy at cpan.org>
+ 2009, Brian Cassidy <brian.cassidy at gmail.com>
+ 2008-2009, Ansgar Burchardt <ansgar at 43-1.org>
+ 2008, gregor herrmann <gregoa at debian.org>
+ 2008, Vincent Danjean <vdanjean at debian.org>
 License: GPL-1+ | Artistic
- This library is free software; you can redistribute it and/or modify it
- under the same terms as Perl itself.
 
+License: Artistic
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the Artistic License, which comes with Perl.
+    On Debian GNU/Linux systems, the complete text of the Artistic License
+    can be found in `/usr/share/common-licenses/Artistic'
+
+License: GPL-1+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 1, or (at your option)
+    any later version.
+    On Debian GNU/Linux systems, the complete text of the GNU General
+    Public License can be found in `/usr/share/common-licenses/GPL'
+

Modified: trunk/libtext-csv-perl/lib/Text/CSV.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtext-csv-perl/lib/Text/CSV.pm?rev=45923&op=diff
==============================================================================
--- trunk/libtext-csv-perl/lib/Text/CSV.pm (original)
+++ trunk/libtext-csv-perl/lib/Text/CSV.pm Sat Oct 17 15:18:38 2009
@@ -5,14 +5,14 @@
 use Carp ();
 
 BEGIN {
-    $Text::CSV::VERSION = '1.14';
+    $Text::CSV::VERSION = '1.15';
     $Text::CSV::DEBUG   = 0;
 }
 
 # if use CSV_XS, requires version
 my $Module_XS  = 'Text::CSV_XS';
 my $Module_PP  = 'Text::CSV_PP';
-my $XS_Version = '0.68';
+my $XS_Version = '0.69';
 
 my $Is_Dynamic = 0;
 
@@ -286,9 +286,9 @@
 
 =head1 VERSION
 
-    1.14
-
-This module is compatible with Text::CSV_XS B<0.68> and later.
+    1.15
+
+This module is compatible with Text::CSV_XS B<0.69> and later.
 
 =head2 Embedded newlines
 

Modified: trunk/libtext-csv-perl/lib/Text/CSV_PP.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtext-csv-perl/lib/Text/CSV_PP.pm?rev=45923&op=diff
==============================================================================
--- trunk/libtext-csv-perl/lib/Text/CSV_PP.pm (original)
+++ trunk/libtext-csv-perl/lib/Text/CSV_PP.pm Sat Oct 17 15:18:38 2009
@@ -11,7 +11,7 @@
 use vars qw($VERSION);
 use Carp ();
 
-$VERSION = '1.22';
+$VERSION = '1.23';
 
 sub PV  { 0 }
 sub IV  { 1 }
@@ -474,9 +474,7 @@
         else {
 
             if (!$self->{verbatim} and $col =~ /\r\n|\n/) {
-                unless (defined $eol and !$allow_eol{$eol}) {
-                    $col =~ s/(?:\r\n|\n).*//sm;
-                }
+                $col =~ s/(?:\r\n|\n).*$//sm;
             }
 
             if ($col =~ /\Q$esc\E\r$/) { # for t/15_flags : test 165 'ESC CR' at line 203
@@ -594,14 +592,24 @@
 
     $self->{_EOF} = eof($io) ? 1 : '';
 
-    my $line = $io->getline();
     my $quot = $self->{quote_char};
     my $sep  = $self->{sep_char};
+    my $re   = qr/(?:\Q$quot\E)/;
+
+    local $/ = "\r" if $self->{_AUTO_DETECT_CR};
+
+    my $line = $io->getline();
     my $eol  = $self->{eol};
 
-    my $re   = qr/(?:\Q$quot\E)/;
-
-    if ( defined $line and $line =~ /${re}0/ ) {
+    # AUTO DETECTION EOL CR
+    if ( defined $line and defined $eol and $eol eq '' and $line =~ /[^\r]\r[^\r\n]/ and eof ) {
+        $self->{_AUTO_DETECT_CR} = 1;
+        $self->{eol} = "\r";
+        seek( $io, 0, 0 ); # restart
+        return $self->getline( $io );
+    }
+
+    if ( defined $line and $line =~ /${re}0/ ) { # null containing line
         my $auto_diag = $self->auto_diag;
         $self->auto_diag( 0 ) if ( $auto_diag ); # stop auto error diag
 
@@ -610,42 +618,53 @@
         }
 
         $self->auto_diag( $auto_diag ) if ( $auto_diag ); # restore
-    }
-    else {
-        $line .= $io->getline() while ( defined $line and scalar(my @list = $line =~ /$re/g) % 2 and !eof($io) );
-
-        if (defined $eol and defined $line) {
-            $line =~ s/\Q$eol\E$//;
-        }
-
-        $self->_parse($line) or return;
-    }
-
-    if ( $self->{_BOUND_COLUMNS} ) {
-        my @vals  = $self->_fields();
-        my ( $max, $count ) = ( scalar @vals, 0 );
-
-        if ( @{ $self->{_BOUND_COLUMNS} } < $max ) {
-                $self->_set_error_diag(3006);
-                return;
-        }
-
-        for ( my $i = 0; $i < $max; $i++ ) {
-            my $bind = $self->{_BOUND_COLUMNS}->[ $i ];
-            if ( Scalar::Util::readonly( $$bind ) ) {
-                $self->_set_error_diag(3008);
-                return;
-            }
-            $$bind = $vals[ $i ];
-        }
-
-        return [];
-    }
-    else {
-        [ $self->_fields() ];
-    }
-
-}
+
+        return $self->_return_getline_result;
+    }
+
+    $line .= $io->getline() while ( defined $line and scalar(my @list = $line =~ /$re/g) % 2 and !eof($io) );
+
+    if ( $self->{verbatim} and defined $eol and defined $line ) { # VERBATIM MODE
+        $line =~ s/\Q$eol\E$//;
+    }
+
+    $self->_parse($line);
+
+    return $self->_return_getline_result();
+}
+
+
+sub _return_getline_result {
+
+    if ( eof ) {
+        $_[0]->{_AUTO_DETECT_CR} = 0;
+    }
+
+    return unless $_[0]->{_STATUS};
+
+    return [ $_[0]->_fields() ] unless $_[0]->{_BOUND_COLUMNS};
+
+    my @vals  = $_[0]->_fields();
+    my ( $max, $count ) = ( scalar @vals, 0 );
+
+    if ( @{ $_[0]->{_BOUND_COLUMNS} } < $max ) {
+            $_[0]->_set_error_diag(3006);
+            return;
+    }
+
+    for ( my $i = 0; $i < $max; $i++ ) {
+        my $bind = $_[0]->{_BOUND_COLUMNS}->[ $i ];
+        if ( Scalar::Util::readonly( $$bind ) ) {
+            $_[0]->_set_error_diag(3008);
+            return;
+        }
+        $$bind = $vals[ $i ];
+    }
+
+    return [];
+}
+
+
 ################################################################################
 # getline_hr
 ################################################################################

Modified: trunk/libtext-csv-perl/t/45_eol.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtext-csv-perl/t/45_eol.t?rev=45923&op=diff
==============================================================================
--- trunk/libtext-csv-perl/t/45_eol.t (original)
+++ trunk/libtext-csv-perl/t/45_eol.t Sat Oct 17 15:18:38 2009
@@ -3,7 +3,7 @@
 use strict;
 $^W = 1;
 
-use Test::More tests => 262;
+use Test::More tests => 278;
 
 BEGIN {
     $ENV{PERL_TEXT_CSV} = 0;
@@ -15,6 +15,8 @@
 $| = 1;
 
 # Embedded newline tests
+
+my $def_rs = $/;
 
 foreach my $rs ("\n", "\r\n", "\r") {
     for $\ (undef, $rs) {
@@ -56,7 +58,7 @@
 		    }
 		else {
 		    ok (my $row = $csv->getline (*FH),	"getline |$s_eol|");
-		    is (ref $row, "ARRAY",			"row     |$s_eol|");
+		    is (ref $row, "ARRAY",		"row     |$s_eol|");
 		    @p = @$row;
 		    }
 
@@ -70,6 +72,7 @@
 	unlink "_eol.csv";
 	}
     }
+$/ = $def_rs;
 
 {   my $csv = Text::CSV->new ({ escape_char => undef });
 
@@ -85,28 +88,50 @@
 SKIP: {
     $] < 5.008 and skip "\$\\ tests don't work in perl 5.6.x and older", 2;
     {   local $\ = "#\r\n";
-    my $csv = Text::CSV->new ();
-    open  FH, ">_eol.csv";
-    $csv->print (*FH, [ "a", 1 ]);
-    close FH;
-    open  FH, "<_eol.csv";
-    local $/;
-    is (<FH>, "a,1#\r\n", "Strange \$\\");
-    close FH;
-    unlink "_eol.csv";
+	my $csv = Text::CSV->new ();
+	open  FH, ">_eol.csv";
+	$csv->print (*FH, [ "a", 1 ]);
+	close FH;
+	open  FH, "<_eol.csv";
+	local $/;
+	is (<FH>, "a,1#\r\n", "Strange \$\\");
+	close FH;
+	unlink "_eol.csv";
+	}
+    {   local $\ = "#\r\n";
+	my $csv = Text::CSV->new ({ eol => $\ });
+	open  FH, ">_eol.csv";
+	$csv->print (*FH, [ "a", 1 ]);
+	close FH;
+	open  FH, "<_eol.csv";
+	local $/;
+	is (<FH>, "a,1#\r\n", "Strange \$\\ + eol");
+	close FH;
+	unlink "_eol.csv";
+	}
     }
-{   local $\ = "#\r\n";
-    my $csv = Text::CSV->new ({ eol => $\ });
-    open  FH, ">_eol.csv";
-    $csv->print (*FH, [ "a", 1 ]);
-    close FH;
-    open  FH, "<_eol.csv";
-    local $/;
-    is (<FH>, "a,1#\r\n", "Strange \$\\ + eol");
-    close FH;
-    unlink "_eol.csv";
+$/ = $def_rs;
+
+
+ok (1, "Auto-detecting \\r");
+{   my @row = qw( a b c ); local $" = ",";
+    for (["\n", "\\n"], ["\r\n", "\\r\\n"], ["\r", "\\r"]) {
+	my ($eol, $s_eol) = @$_;
+	open  FH, ">_eol.csv";
+	print FH qq{@row$eol at row$eol at row$eol\x91};
+	close FH;
+	open  FH, "<_eol.csv";
+
+	my $c = Text::CSV->new ({ binary => 1, auto_diag => 1 });
+	is ($c->eol (),			"",		"default EOL");
+	is_deeply ($c->getline (*FH),	[ @row ],	"EOL 1 $s_eol");
+	is ($c->eol (),	$eol eq "\r" ? "\r" : "",	"EOL");
+	is_deeply ($c->getline (*FH),	[ @row ],	"EOL 2 $s_eol");
+	is_deeply ($c->getline (*FH),	[ @row ],	"EOL 3 $s_eol");
+	close FH;
+	unlink "_eol.csv";
+	}
     }
-}
 
 ok (1, "Specific \\r test from tfrayner");
 {   $/ = "\r";
@@ -127,7 +152,7 @@
     close FH;
     unlink "_eol.csv";
     }
-
+$/ = $def_rs;
 
 ok (1, "EOL undef");
 {   $/ = "\r";
@@ -144,6 +169,6 @@
     close FH;
     unlink "_eol.csv";
     }
-
+$/ = $def_rs;
 
 1;

Modified: trunk/libtext-csv-perl/t/65_allow.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtext-csv-perl/t/65_allow.t?rev=45923&op=diff
==============================================================================
--- trunk/libtext-csv-perl/t/65_allow.t (original)
+++ trunk/libtext-csv-perl/t/65_allow.t Sat Oct 17 15:18:38 2009
@@ -14,7 +14,7 @@
     }
 
 my $csv;
-
+#=pod
 ok (1, "Allow unescaped quotes");
 # Allow unescaped quotes inside an unquoted field
 {   my @bad = (
@@ -293,7 +293,7 @@
 	    }
 	}
     }
-
+#=cut
 {   ok (1, "verbatim");
     my $csv = Text::CSV->new ({
 	sep_char => "^",
@@ -341,12 +341,16 @@
 	my @fld = $csv->fields;
 	is (@fld, 4,				"#\\r\\n $gc fields");
 	is ($fld[2], "Abe",			"#\\r\\n $gc fld 2");
-	is ($fld[3], "Timmerman#\r\n",		"#\\r\\n $gc fld 3");
+#	is ($fld[3], "Timmerman#\r\n",		"#\\r\\n $gc fld 3");
+	is ($fld[3], $gc ? "Timmerman#\r\n"
+			 : "Timmerman#",	"#\\r\\n $gc fld 3");
 
 	ok ($csv->parse ($str[1]),		"#\\r\\n $gc parse");
 	@fld = $csv->fields;
 	is (@fld, 3,				"#\\r\\n $gc fields");
-	is ($fld[2], "Abe\nTimmerman#\r\n",	"#\\r\\n $gc fld 2");
+#	is ($fld[2], "Abe\nTimmerman#\r\n",	"#\\r\\n $gc fld 2");
+	is ($fld[2], $gc ? "Abe\nTimmerman#\r\n"
+			 : "Abe",		"#\\r\\n $gc fld 2");
 	}
 
     ok (1, "verbatim on getline (*FH)");
@@ -363,11 +367,15 @@
 	ok ($row = $csv->getline (*FH),		"#\\r\\n $gc getline");
 	is (@$row, 4,				"#\\r\\n $gc fields");
 	is ($row->[2], "Abe",			"#\\r\\n $gc fld 2");
-	is ($row->[3], "Timmerman",		"#\\r\\n $gc fld 3");
+#	is ($row->[3], "Timmerman",		"#\\r\\n $gc fld 3");
+	is ($row->[3], $gc ? "Timmerman"
+			   : "Timmerman#",	"#\\r\\n $gc fld 3");
 
 	ok ($row = $csv->getline (*FH),		"#\\r\\n $gc parse");
 	is (@$row, 3,				"#\\r\\n $gc fields");
-	is ($row->[2], "Abe\nTimmerman",	"#\\r\\n $gc fld 2");
+#	is ($row->[2], "Abe\nTimmerman",	"#\\r\\n $gc fld 2");
+	is ($row->[2], $gc ? "Abe\nTimmerman"
+			   : "Abe",		"#\\r\\n $gc fld 2");
 	}
 
     $gc = $csv->verbatim ();




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