r24818 - in /trunk/libtext-csv-perl: Changes META.yml README debian/changelog debian/control lib/Text/CSV.pm lib/Text/CSV_PP.pm t/45_eol.t t/65_allow.t t/70_rt.t t/71_pp.t t/80_diag.t

ansgar-guest at users.alioth.debian.org ansgar-guest at users.alioth.debian.org
Sat Sep 6 13:45:08 UTC 2008


Author: ansgar-guest
Date: Sat Sep  6 13:45:05 2008
New Revision: 24818

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=24818
Log:
* New upstream release
  + bump version of recommended libtext-cvs-xs-perl to 0.54

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/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
    trunk/libtext-csv-perl/t/70_rt.t
    trunk/libtext-csv-perl/t/71_pp.t
    trunk/libtext-csv-perl/t/80_diag.t

Modified: trunk/libtext-csv-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtext-csv-perl/Changes?rev=24818&op=diff
==============================================================================
--- trunk/libtext-csv-perl/Changes (original)
+++ trunk/libtext-csv-perl/Changes Sat Sep  6 13:45:05 2008
@@ -1,4 +1,12 @@
 Revision history for Perl extension Text::CSV.
+
+1.09  Fri Sep  5 11:34:00 2008
+	- updated the compatibility for Text::CSV_XS version 0.54
+	    * default eol for print is $\
+	    * fixed SetDiag(0)
+	    * IO failure in print
+
+	**** Text::CSV_PP doesn't support the error msg 2023 ****
 
 1.08  Fri Aug 22 11:21:38 2008
 	- fixed a bug in parsing tab separated values with allow_whitespace

Modified: trunk/libtext-csv-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtext-csv-perl/META.yml?rev=24818&op=diff
==============================================================================
--- trunk/libtext-csv-perl/META.yml (original)
+++ trunk/libtext-csv-perl/META.yml Sat Sep  6 13:45:05 2008
@@ -1,6 +1,6 @@
 --- #YAML:1.0
 name:                Text-CSV
-version:             1.08
+version:             1.09
 abstract:            comma-separated values manipulator (using XS or PurePerl)
 license:             ~
 author:              

Modified: trunk/libtext-csv-perl/README
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtext-csv-perl/README?rev=24818&op=diff
==============================================================================
--- trunk/libtext-csv-perl/README (original)
+++ trunk/libtext-csv-perl/README Sat Sep  6 13:45:05 2008
@@ -1,4 +1,4 @@
-Text::CSV version 1.08
+Text::CSV version 1.09
 ========================
 
 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=24818&op=diff
==============================================================================
--- trunk/libtext-csv-perl/debian/changelog (original)
+++ trunk/libtext-csv-perl/debian/changelog Sat Sep  6 13:45:05 2008
@@ -1,3 +1,10 @@
+libtext-csv-perl (1.09-1) UNRELEASED; urgency=low
+
+  * New upstream release
+    + bump version of recommended libtext-cvs-xs-perl to 0.54
+
+ -- Ansgar Burchardt <ansgar at 43-1.org>  Sat, 06 Sep 2008 15:38:05 +0200
+
 libtext-csv-perl (1.08-1) unstable; urgency=low
 
   [ Tim Retout ]

Modified: trunk/libtext-csv-perl/debian/control
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtext-csv-perl/debian/control?rev=24818&op=diff
==============================================================================
--- trunk/libtext-csv-perl/debian/control (original)
+++ trunk/libtext-csv-perl/debian/control Sat Sep  6 13:45:05 2008
@@ -14,7 +14,7 @@
 Package: libtext-csv-perl
 Architecture: all
 Depends: ${perl:Depends}, ${misc:Depends}
-Recommends: libtext-csv-xs-perl (>= 0.52)
+Recommends: libtext-csv-xs-perl (>= 0.54)
 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

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=24818&op=diff
==============================================================================
--- trunk/libtext-csv-perl/lib/Text/CSV.pm (original)
+++ trunk/libtext-csv-perl/lib/Text/CSV.pm Sat Sep  6 13:45:05 2008
@@ -5,14 +5,14 @@
 use Carp ();
 
 BEGIN {
-    $Text::CSV::VERSION = '1.08';
+    $Text::CSV::VERSION = '1.09';
     $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.52';
+my $XS_Version = '0.54';
 
 my $Is_Dynamic = 0;
 
@@ -270,9 +270,9 @@
 
 =head1 VERSION
 
-    1.08
-
-This module is compatible with Text::CSV_XS B<0.52> or later.
+    1.09
+
+This module is compatible with Text::CSV_XS B<0.54> or later.
 
 =head2 BINARY MODE
 

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=24818&op=diff
==============================================================================
--- trunk/libtext-csv-perl/lib/Text/CSV_PP.pm (original)
+++ trunk/libtext-csv-perl/lib/Text/CSV_PP.pm Sat Sep  6 13:45:05 2008
@@ -11,7 +11,7 @@
 use vars qw($VERSION);
 use Carp ();
 
-$VERSION = '1.16';
+$VERSION = '1.17';
 
 sub PV  { 0 }
 sub IV  { 1 }
@@ -42,6 +42,8 @@
         2037 => "EIF - Binary character in unquoted field, binary off",
 
         2110 => "ECB - Binary character in Combine, binary off",
+
+        2200 => "EIO - print to IO failed. See errno",
 
         # PP Only Error
         4002 => "EIQ - Unescaped ESC in quoted field",
@@ -150,11 +152,11 @@
 
     $last_new_error = '';
 
+    defined $\ and $self->{eol} = $\;
+
     bless $self, $class;
 
-    if(exists($self->{types})) {
-        $self->types($self->{types});
-    }
+    $self->types( $self->{types} ) if( exists( $self->{types} ) );
 
     return $self;
 }
@@ -360,6 +362,7 @@
             else {
                 $self->_set_error_diag(
                       $col =~ /\Q$quot\E(.*)\Q$quot\E\r$/   ? (2010, $pos - 2)
+                    : $col =~ /\n/                          ? (2030, $pos - length $col)
                     : $col =~ /^\r/                         ? (2031, $pos - length $col)
                     : $col =~ /\r([^\r]*)/                  ? (2032, $pos - 1 - length $1)
                     : (2037, $pos - length $col) # Binary character in unquoted field, binary off
@@ -534,7 +537,7 @@
 
     $self->_combine(@$cols) or return '';
 
-    $io->print( $self->_string );
+    $io->print( $self->_string ) or $self->_set_error_diag(2200);
 }
 ################################################################################
 # getline
@@ -740,6 +743,8 @@
 sub SetDiag {
     if ( defined $_[1] and $_[1] == 0 ) {
         $_[0]->{_ERROR_DIAG} = undef;
+        $last_new_error = '';
+        return;
     }
 
     $_[0]->_set_error_diag( $_[1] );
@@ -1376,7 +1381,7 @@
 
 =item 2027 "EIQ - Quoted field not terminated"
 
-=item 2030 "EIF - NL char inside unquoted verbatim, binary off",
+=item 2030 "EIF - NL char inside unquoted verbatim, binary off"
 
 =item 2031 "EIF - CR char is first char of field, not part of EOL",
 
@@ -1387,6 +1392,8 @@
 =item 2037 "EIF - Binary character in unquoted field, binary off",
 
 =item 2110 "ECB - Binary character in Combine, binary off"
+
+=item 2200 "EIO - print to IO failed. See errno"
 
 =item 4002 "EIQ - Unescaped ESC in quoted field"
 

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=24818&op=diff
==============================================================================
--- trunk/libtext-csv-perl/t/45_eol.t (original)
+++ trunk/libtext-csv-perl/t/45_eol.t Sat Sep  6 13:45:05 2008
@@ -3,14 +3,14 @@
 use strict;
 $^W = 1;
 
-use Test::More tests => 128;
+use Test::More tests => 133;
 
 BEGIN {
     $ENV{PERL_TEXT_CSV} = 0;
     require_ok "Text::CSV";
     plan skip_all => "Cannot load Text::CSV" if $@;
     require "t/util.pl";
-}
+    }
 
 $| = 1;
 
@@ -69,6 +69,17 @@
     unlink "_eol.csv";
     }
 
+{   my $csv = Text::CSV->new ({ escape_char => undef });
+
+    ok ($csv->parse (qq{"x"\r\n}), "Trailing \\r\\n with no escape char");
+
+    is ($csv->eol ("\r"), "\r", "eol set to \\r");
+    ok ($csv->parse (qq{"x"\r}),   "Trailing \\r with no escape char");
+
+    ok ($csv->allow_whitespace (1), "Allow whitespace");
+    ok ($csv->parse (qq{"x" \r}),  "Trailing \\r with no escape char");
+    }
+
 ok (1, "Specific \\r test from tfrayner");
 {   $/ = "\r";
     open  FH, ">_eol.csv";

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=24818&op=diff
==============================================================================
--- trunk/libtext-csv-perl/t/65_allow.t (original)
+++ trunk/libtext-csv-perl/t/65_allow.t Sat Sep  6 13:45:05 2008
@@ -4,7 +4,7 @@
 $^W = 1;
 
 #use Test::More "no_plan";
- use Test::More tests => 829;
+ use Test::More tests => 838;
 
 BEGIN {
     $ENV{PERL_TEXT_CSV} = 0;
@@ -313,6 +313,20 @@
     is ($row->[2], "*\r\n",			"#\\r\\n $gc fld 2");
 
     close FH;
+
+    $csv = Text::CSV->new ({
+	binary		=> 0,
+	verbatim	=> 1,
+	eol		=> "#\r\n",
+	});
+    open  FH, ">_test.csv";
+    print FH $str[1];
+    close FH;
+    open  FH, "<_test.csv";
+    is ($csv->getline (*FH), undef,	"#\\r\\n $gc getline 2030");
+    is (0 + $csv->error_diag (), 2030,	"Got 2030");
+    close FH;
+
     unlink "_test.csv";
     }
 
@@ -347,3 +361,22 @@
     close FH;
     unlink "_test.csv";
     }
+
+{   my $csv = Text::CSV->new ({});
+
+    my $s2023 = qq{2023,",2008-04-05,"  \tFoo, Bar",\n}; # "
+    #                                ^
+
+    is ($csv->parse ($s2023), 0,		"Parse 2023");
+    is (($csv->error_diag ())[0], 2027,		"Fail code 2027, but 2023 in CSV_XS");
+    is (($csv->error_diag ())[2], 5,		"Fail position");
+#    is (($csv->error_diag ())[0], 2023,		"Fail code 2023");
+#    is (($csv->error_diag ())[2], 19,		"Fail position");
+
+    is ($csv->allow_whitespace (1), 1,		"Allow whitespace");
+    is ($csv->parse ($s2023), 0,		"Parse 2023");
+    is (($csv->error_diag ())[0], 2027,		"FFail code 2027, but 2023 in CSV_XS");
+    is (($csv->error_diag ())[2], 5,		"Space is eaten now");
+#    is (($csv->error_diag ())[0], 2023,		"Fail code 2023");
+#    is (($csv->error_diag ())[2], 22,		"Space is eaten now");
+    }

Modified: trunk/libtext-csv-perl/t/70_rt.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtext-csv-perl/t/70_rt.t?rev=24818&op=diff
==============================================================================
--- trunk/libtext-csv-perl/t/70_rt.t (original)
+++ trunk/libtext-csv-perl/t/70_rt.t Sat Sep  6 13:45:05 2008
@@ -4,13 +4,16 @@
 $^W = 1;
 
 #use Test::More "no_plan";
- use Test::More tests => 69;
+ use Test::More tests => 73;
 
 BEGIN {
     $ENV{PERL_TEXT_CSV} = 0;
     use_ok "Text::CSV", ();
     plan skip_all => "Cannot load Text::CSV" if $@;
-}
+    }
+
+my $csv_file = "_test.csv";
+END { unlink $csv_file }
 
 my $rt_no;
 my %input;
@@ -42,11 +45,11 @@
 {   # http://rt.cpan.org/Ticket/Display.html?id=21530
     # 21530: getline () does not return documented value at end of filehandle
     # IO::Handle  was first released with perl 5.00307
-    open  FH, ">_test.csv";
+    open  FH, ">$csv_file";
     print FH @{$input{21530}};
     close FH;
     ok (my $csv = Text::CSV->new ({ binary => 1 }), "RT-21530: getline () return at eof");
-    open  FH, "<_test.csv";
+    open  FH, "<$csv_file";
     my $row;
     foreach my $line (1 .. 5) {
 	ok ($row = $csv->getline (*FH), "getline $line");
@@ -56,7 +59,7 @@
     ok (eof FH, "EOF");
     is ($row = $csv->getline (*FH), undef, "getline EOF");
     close FH;
-    unlink "_test.csv";
+    unlink $csv_file;
     }
 
 {   # http://rt.cpan.org/Ticket/Display.html?id=21530
@@ -93,12 +96,12 @@
 
 {   # http://rt.cpan.org/Ticket/Display.html?id=34474
     # 34474: wish: integrate row-as-hashref feature from Parse::CSV
-    open  FH, ">_test.csv";
+    open  FH, ">$csv_file";
     print FH @{$input{34474}};
     close FH;
     ok (my $csv = Text::CSV->new (),		"RT-34474: getline_hr ()");
     is ($csv->column_names, undef,		"No headers yet");
-    open  FH, "<_test.csv";
+    open  FH, "<$csv_file";
     my $row;
     ok ($row = $csv->getline (*FH),		"getline headers");
     is ($row->[0], "code",			"Header line");
@@ -111,7 +114,24 @@
 	like ($hr->{name}, qr/^[A-Z][a-z]+$/,	"Name");
 	}
     close FH;
-    unlink "_test.csv";
+    unlink $csv_file;
+    }
+
+{   # http://rt.cpan.org/Ticket/Display.html?id=38960
+    # 38960: print () on invalid filehandle warns and returns success
+    open  FH, ">$csv_file";
+    print FH "";
+    close FH;
+    my $err = "";
+    open  FH, "<$csv_file";
+    ok (my $csv = Text::CSV->new (),		"RT-38960: print () fails");
+    local $SIG{__WARN__} = sub { $err = "Warning" };
+    ok (!$csv->print (*FH, [ 1 .. 4 ]),		"print ()");
+    is ($err, "Warning",			"IO::Handle triggered a warning");
+    my @err = $csv->error_diag ();
+    is ($err[0], 2200,	"error 2200");
+    close FH;
+    unlink $csv_file;
     }
 
 __END__

Modified: trunk/libtext-csv-perl/t/71_pp.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtext-csv-perl/t/71_pp.t?rev=24818&op=diff
==============================================================================
--- trunk/libtext-csv-perl/t/71_pp.t (original)
+++ trunk/libtext-csv-perl/t/71_pp.t Sat Sep  6 13:45:05 2008
@@ -6,7 +6,6 @@
 $^W = 1;
 
 use Test::More tests => 3;
-#use Test::More "no_plan";
 
 
 BEGIN { $ENV{PERL_TEXT_CSV} = $ARGV[0] || 0; }
@@ -16,12 +15,8 @@
     plan skip_all => "Cannot load Text::CSV" if $@;
 }
 
-#print Text::CSV->backend, "\t", Text::CSV->backend->VERSION, "\n";
-
 my $csv = Text::CSV->new( { sep_char => "\t", blank_is_undef => 1, allow_whitespace => 1 } );
 
 ok $csv->parse(qq|John\t\t"my notes"|);
 
-is( 'John,undef,my notes', join( ',', map { ! defined $_ ? 'undef' : $_ } $csv->fields ) );
-
-
+is_deeply ([ $csv->fields ], [ "John", undef, "my notes" ], "Tab with allow_white_space");

Modified: trunk/libtext-csv-perl/t/80_diag.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtext-csv-perl/t/80_diag.t?rev=24818&op=diff
==============================================================================
--- trunk/libtext-csv-perl/t/80_diag.t (original)
+++ trunk/libtext-csv-perl/t/80_diag.t Sat Sep  6 13:45:05 2008
@@ -3,7 +3,7 @@
 use strict;
 $^W = 1;
 
- use Test::More tests => 84;
+ use Test::More tests => 86;
 #use Test::More "no_plan";
 
 my %err;
@@ -79,6 +79,10 @@
 is (Text::CSV::error_diag (bless {}, "Foo") . '', "Unknown attribute 'ecs_char'",
 					"Last failure for new () - FAIL");
 
+$csv->SetDiag (0);
+is (0 + $csv->error_diag (), 0,  "Reset error NUM");
+is (''. $csv->error_diag (), "", "Reset error NUM");
+
 package Text::CSV::Subclass;
 
 use base "Text::CSV";




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