r35516 - in /trunk/libtext-csv-perl: Changes META.yml README debian/changelog debian/control lib/Text/CSV.pm lib/Text/CSV_PP.pm t/12_acc.t t/22_scalario.t t/45_eol.t t/71_pp.t t/80_diag.t
ansgar-guest at users.alioth.debian.org
ansgar-guest at users.alioth.debian.org
Sat May 16 15:26:40 UTC 2009
Author: ansgar-guest
Date: Sat May 16 15:26:35 2009
New Revision: 35516
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=35516
Log:
New upstream release.
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/12_acc.t
trunk/libtext-csv-perl/t/22_scalario.t
trunk/libtext-csv-perl/t/45_eol.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=35516&op=diff
==============================================================================
--- trunk/libtext-csv-perl/Changes (original)
+++ trunk/libtext-csv-perl/Changes Sat May 16 15:26:35 2009
@@ -1,4 +1,11 @@
Revision history for Perl extension Text::CSV.
+
+1.12 Sat May 16 10:46:38 2009
+ - updated the compatibility for Text::CSV_XS version 0.65
+ * new()ing errors can be checked on number (1002)
+ * modified doc for error_diag() return value in case of constructor failure
+ - parse() didn't set the given string ref into {_STRING}. (rt#45215)
+ - getline() didn't handle a line having null (ex. "0)
1.11 Sat Mar 21 16:07:29 2009
- updated the compatibility for Text::CSV_XS version 0.63
Modified: trunk/libtext-csv-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtext-csv-perl/META.yml?rev=35516&op=diff
==============================================================================
--- trunk/libtext-csv-perl/META.yml (original)
+++ trunk/libtext-csv-perl/META.yml Sat May 16 15:26:35 2009
@@ -1,6 +1,6 @@
--- #YAML:1.0
name: Text-CSV
-version: 1.11
+version: 1.12
abstract: comma-separated values manipulator (using XS or PurePerl)
license: perl
author:
Modified: trunk/libtext-csv-perl/README
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtext-csv-perl/README?rev=35516&op=diff
==============================================================================
--- trunk/libtext-csv-perl/README (original)
+++ trunk/libtext-csv-perl/README Sat May 16 15:26:35 2009
@@ -1,4 +1,4 @@
-Text::CSV version 1.11
+Text::CSV version 1.12
========================
comma-separated values manipulator
@@ -31,7 +31,7 @@
COPYRIGHT AND LICENSE
Copyright (C) 1997 Alan Citterman. All rights reserved.
- Copyright (C) 2007-2008 Makamaka Hannyaharamitu. All rights reserved.
+ Copyright (C) 2007-2009 Makamaka Hannyaharamitu. All rights reserved.
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.
Modified: trunk/libtext-csv-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtext-csv-perl/debian/changelog?rev=35516&op=diff
==============================================================================
--- trunk/libtext-csv-perl/debian/changelog (original)
+++ trunk/libtext-csv-perl/debian/changelog Sat May 16 15:26:35 2009
@@ -1,3 +1,9 @@
+libtext-csv-perl (1.12-1) unstable; urgency=low
+
+ * New upstream release.
+
+ -- Ansgar Burchardt <ansgar at 43-1.org> Sat, 16 May 2009 17:26:23 +0200
+
libtext-csv-perl (1.11-1) unstable; urgency=low
[ gregor herrmann ]
Modified: trunk/libtext-csv-perl/debian/control
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtext-csv-perl/debian/control?rev=35516&op=diff
==============================================================================
--- trunk/libtext-csv-perl/debian/control (original)
+++ trunk/libtext-csv-perl/debian/control Sat May 16 15:26:35 2009
@@ -14,7 +14,7 @@
Package: libtext-csv-perl
Architecture: all
Depends: ${perl:Depends}, ${misc:Depends}
-Recommends: libtext-csv-xs-perl (>= 0.63)
+Recommends: libtext-csv-xs-perl (>= 0.65)
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=35516&op=diff
==============================================================================
--- trunk/libtext-csv-perl/lib/Text/CSV.pm (original)
+++ trunk/libtext-csv-perl/lib/Text/CSV.pm Sat May 16 15:26:35 2009
@@ -5,14 +5,14 @@
use Carp ();
BEGIN {
- $Text::CSV::VERSION = '1.11';
+ $Text::CSV::VERSION = '1.12';
$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.63';
+my $XS_Version = '0.65';
my $Is_Dynamic = 0;
@@ -270,9 +270,9 @@
=head1 VERSION
- 1.11
-
-This module is compatible with Text::CSV_XS B<0.63> and later.
+ 1.12
+
+This module is compatible with Text::CSV_XS B<0.65> and later.
=head2 BINARY MODE
@@ -955,7 +955,7 @@
=head1 SEE ALSO
-L<Text::CSV_PP(3)>, L<Text::CSV_XS(3)> and L<Text::CSV::Encoded(3)>.
+L<Text::CSV_PP>, L<Text::CSV_XS> and L<Text::CSV::Encoded>.
=head1 AUTHORS and MAINTAINERS
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=35516&op=diff
==============================================================================
--- trunk/libtext-csv-perl/lib/Text/CSV_PP.pm (original)
+++ trunk/libtext-csv-perl/lib/Text/CSV_PP.pm Sat May 16 15:26:35 2009
@@ -11,7 +11,7 @@
use vars qw($VERSION);
use Carp ();
-$VERSION = '1.19';
+$VERSION = '1.20';
sub PV { 0 }
sub IV { 1 }
@@ -65,6 +65,7 @@
my $last_new_error = '';
+my $last_new_err_num;
my %def_attr = (
quote_char => '"',
@@ -145,7 +146,7 @@
for my $prop (keys %$attr) { # if invalid attr, return undef
unless ($prop =~ /^[a-z]/ && exists $def_attr{$prop}) {
- $last_new_error = "Unknown attribute '$prop'";
+ $last_new_error = "INI - Unknown attribute '$prop'";
return;
}
$self->{$prop} = $attr->{$prop};
@@ -157,9 +158,9 @@
( defined $self->{escape_char} && $self->{escape_char} =~ m/^[ \t]$/ )
) {
$last_new_error = "INI - allow_whitespace with escape_char or quote_char SP or TAB";
+ $last_new_err_num = 1002;
return;
}
-
$last_new_error = '';
@@ -191,7 +192,7 @@
my @diag = (0, $last_new_error, 0);
unless ($self and ref $self) { # Class method or direct call
- $last_new_error and $diag[0] = 1000;
+ $last_new_error and $diag[0] = defined $last_new_err_num ? $last_new_err_num : 1000;
}
elsif ( $self->isa (__PACKAGE__) and defined $self->{_ERROR_DIAG} ) {
@diag = ( 0 + $self->{_ERROR_DIAG}, $ERRORS->{ $self->{_ERROR_DIAG} } );
@@ -285,7 +286,8 @@
}
}
- $self->{_STRING} = \do { join($sep, @part) . $self->{eol} };
+# $self->{_STRING} = \do { join($sep, @part) . $self->{eol} };
+ $self->{_STRING} = \do { join($sep, @part) . ( defined $self->{eol} ? $self->{eol} : '' ) };
$self->{_STATUS} = 1;
return $self->{_STATUS};
@@ -300,7 +302,7 @@
sub _parse {
my ($self, $line) = @_;
- @{$self}{qw/_STRING _FIELDS _STATUS _ERROR_INPUT/} = ($line, undef, 0, $line);
+ @{$self}{qw/_STRING _FIELDS _STATUS _ERROR_INPUT/} = ( \do{ defined $line ? "$line" : undef }, undef, 0, $line );
return 0 if(!defined $line);
@@ -353,7 +355,7 @@
my $utf8 = 1 if utf8::is_utf8( $line ); # if UTF8 marked, flag on.
- for my $col ($line =~ /$re_split/g) {
+ for my $col ( $line =~ /$re_split/g ) {
if ($keep_meta_info) {
$flag = 0x0000;
@@ -420,30 +422,6 @@
last;
}
}
-=pod
-
- if ($col =~ $re_in_quot_esp1) {
- my $str = $1;
- if ($str !~ $re_in_quot_esp2) {
- unless ($self->{allow_loose_escapes}) {
- $self->_set_error_diag( 2025, $pos - 2 ); # Needless ESC in quoted field
- $palatable = 0;
- last;
- }
- else {
- $col =~ s/\Q$esc\E(.)/$1/g;
- }
- }
- }
- else {
- if ($col =~ /(?<!\Q$esc\E)\Q$esc\E/) {
- $self->_set_error_diag( 4002, $pos - 1 ); # No escaped ESC in quoted field
- $palatable = 0;
- last;
- }
- }
-
-=cut
$col =~ s{$re_esc}{$1 eq '0' ? "\0" : $1}eg;
@@ -595,7 +573,7 @@
my $line = $io->getline();
my $quot = $self->{quote_char};
- my $re = qr/(?:\Q$quot\E)/;
+ my $re = $self->binary ? qr/(?:\Q$quot\E)(?!0)/ : qr/(?:\Q$quot\E)/;
$line .= $io->getline() while ( defined $line and scalar(my @list = $line =~ /$re/g) % 2 and !eof($io) );
@@ -1170,7 +1148,7 @@
C<error_diag ()> will return a string like
- "Unknown attribute 'ecs_char'"
+ "INI - Unknown attribute 'ecs_char'"
=head2 combine
Modified: trunk/libtext-csv-perl/t/12_acc.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtext-csv-perl/t/12_acc.t?rev=35516&op=diff
==============================================================================
--- trunk/libtext-csv-perl/t/12_acc.t (original)
+++ trunk/libtext-csv-perl/t/12_acc.t Sat May 16 15:26:35 2009
@@ -3,7 +3,7 @@
use strict;
$^W = 1; # use warnings core since 5.6
-use Test::More tests => 47;
+use Test::More tests => 66;
BEGIN {
$ENV{PERL_TEXT_CSV} = 0;
@@ -52,11 +52,11 @@
qq{=txt \\=, "Hi!"=;=Yes=;==;=2=;;=1.09=;=\r=;\r}, "string");
# Funny settings, all three translate to \0 internally
-$csv = Text::CSV->new ({
+ok ($csv = Text::CSV->new ({
sep_char => undef,
quote_char => undef,
escape_char => undef,
- });
+ }), "new (undef ...)");
is ($csv->sep_char, undef, "sep_char undef");
is ($csv->quote_char, undef, "quote_char undef");
is ($csv->escape_char, undef, "escape_char undef");
@@ -69,14 +69,37 @@
$csv->binary (1);
ok ( $csv->parse ("foo,foo\0bar"), "parse (foo)");
+# Some forbidden combinations
+foreach my $ws (" ", "\t") {
+ ok ($csv = Text::CSV->new ({ escape_char => $ws }), "New blank escape");
+ eval { ok ($csv->allow_whitespace (1), "Allow ws") };
+ is (($csv->error_diag)[0], 1002, "Wrong combo");
+ ok ($csv = Text::CSV->new ({ quote_char => $ws }), "New blank quote");
+ eval { ok ($csv->allow_whitespace (1), "Allow ws") };
+ is (($csv->error_diag)[0], 1002, "Wrong combo");
+ ok ($csv = Text::CSV->new ({ allow_whitespace => 1 }), "New ws 1");
+ eval { ok ($csv->escape_char ($ws), "esc") };
+ is (($csv->error_diag)[0], 1002, "Wrong combo");
+ ok ($csv = Text::CSV->new ({ allow_whitespace => 1 }), "New ws 1");
+ eval { ok ($csv->quote_char ($ws), "esc") };
+ is (($csv->error_diag)[0], 1002, "Wrong combo");
+ }
+eval { $csv = Text::CSV->new ({
+ escape_char => "\t",
+ quote_char => " ",
+ allow_whitespace => 1,
+ }) };
+like ((Text::CSV::error_diag)[1], qr{^INI - allow_whitespace}, "Wrong combo - error message");
+is ( (Text::CSV::error_diag)[0], 1002, "Wrong combo - numeric error");
+
# And test erroneous calls
is (Text::CSV::new (0), undef, "new () as function");
is (Text::CSV::error_diag () . '', "usage: my \$csv = Text::CSV_PP->new ([{ option => value, ... }]);",
"Generic usage () message");
is (Text::CSV->new ({ oel => "" }), undef, "typo in attr");
-is (Text::CSV::error_diag () . '', "Unknown attribute 'oel'", "Unsupported attr");
+is (Text::CSV::error_diag () . '', "INI - Unknown attribute 'oel'", "Unsupported attr");
is (Text::CSV->new ({ _STATUS => "" }), undef, "private attr");
-is (Text::CSV::error_diag () . '', "Unknown attribute '_STATUS'", "Unsupported private attr");
+is (Text::CSV::error_diag () . '', "INI - Unknown attribute '_STATUS'", "Unsupported private attr");
1;
Modified: trunk/libtext-csv-perl/t/22_scalario.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtext-csv-perl/t/22_scalario.t?rev=35516&op=diff
==============================================================================
--- trunk/libtext-csv-perl/t/22_scalario.t (original)
+++ trunk/libtext-csv-perl/t/22_scalario.t Sat May 16 15:26:35 2009
@@ -10,8 +10,9 @@
BEGIN {
unless (exists $Config{useperlio} &&
defined $Config{useperlio} &&
+ $] >= 5.008 && # perlio was experimental in 5.6.2, but not reliable
$Config{useperlio} eq "define") {
- plan skip_all => "No perlIO available";
+ plan skip_all => "No reliable perlIO available";
}
else {
plan tests => 105;
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=35516&op=diff
==============================================================================
--- trunk/libtext-csv-perl/t/45_eol.t (original)
+++ trunk/libtext-csv-perl/t/45_eol.t Sat May 16 15:26:35 2009
@@ -3,7 +3,7 @@
use strict;
$^W = 1;
-use Test::More tests => 255;
+use Test::More tests => 262;
BEGIN {
$ENV{PERL_TEXT_CSV} = 0;
@@ -82,7 +82,9 @@
ok ($csv->parse (qq{"x" \r}), "Trailing \\r with no escape char");
}
-{ local $\ = "#\r\n";
+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 ]);
@@ -104,6 +106,7 @@
close FH;
unlink "_eol.csv";
}
+}
ok (1, "Specific \\r test from tfrayner");
{ $/ = "\r";
@@ -125,4 +128,22 @@
unlink "_eol.csv";
}
+
+ok (1, "EOL undef");
+{ $/ = "\r";
+ ok (my $csv = Text::CSV->new ({eol => undef }), "new csv with eol => undef");
+ open FH, ">_eol.csv";
+ ok ($csv->print (*FH, [1, 2, 3]), "print");
+ ok ($csv->print (*FH, [4, 5, 6]), "print");
+ close FH;
+
+ open FH, "<_eol.csv";
+ ok (my $row = $csv->getline (*FH), "getline 1");
+ is (scalar @$row, 5, "# fields");
+ is_deeply ($row, [ 1, 2, 34, 5, 6], "fields 1");
+ close FH;
+ unlink "_eol.csv";
+ }
+
+
1;
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=35516&op=diff
==============================================================================
--- trunk/libtext-csv-perl/t/71_pp.t (original)
+++ trunk/libtext-csv-perl/t/71_pp.t Sat May 16 15:26:35 2009
@@ -5,7 +5,7 @@
use strict;
$^W = 1;
-use Test::More tests => 3;
+use Test::More tests => 7;
BEGIN { $ENV{PERL_TEXT_CSV} = $ARGV[0] || 0; }
@@ -20,3 +20,52 @@
ok $csv->parse(qq|John\t\t"my notes"|);
is_deeply ([ $csv->fields ], [ "John", undef, "my notes" ], "Tab with allow_white_space");
+
+
+
+# 2009-04-23 rt#45215
+
+my $str = "this,is,some,csv,data\n";
+
+$csv = Text::CSV->new;
+$csv->parse($str);
+
+is( $csv->string, $str );
+
+
+# 2009-05-16
+# getline() handles having escaped null
+
+my $opts = {
+ 'escape_char' => '"',
+ 'quote_char' => '"',
+ 'binary' => 1,
+ 'sep_char' => ','
+};
+
+my $eol = "\r\n";
+my $blob = ( join "", map { chr $_ } 0 .. 255 ) x 1;
+
+$csv = Text::CSV->new( $opts );
+
+open( FH, '>__test.csv' ) or die $!;
+binmode FH;
+
+# writting
+ok( $csv->print( *FH, [ $blob ] ) );
+close( FH );
+
+# reading
+open( FH, "__test.csv" ) or die $!;
+binmode FH;
+
+$opts->{eol} = $eol;
+$csv = Text::CSV->new( $opts );
+
+ok( my $colref = $csv->getline( *FH ) );
+
+is( $colref->[0], $blob, "blob" );
+
+close( FH );
+unlink( '__test.csv' );
+
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=35516&op=diff
==============================================================================
--- trunk/libtext-csv-perl/t/80_diag.t (original)
+++ trunk/libtext-csv-perl/t/80_diag.t Sat May 16 15:26:35 2009
@@ -72,11 +72,11 @@
is (Text::CSV->new ({ ecs_char => ":" }), undef, "Unsupported option");
-is (Text::CSV::error_diag() . '', "Unknown attribute 'ecs_char'",
+is (Text::CSV::error_diag() . '', "INI - Unknown attribute 'ecs_char'",
"Last failure for new () - FAIL");
-is (Text::CSV->error_diag() . '', "Unknown attribute 'ecs_char'",
+is (Text::CSV->error_diag() . '', "INI - Unknown attribute 'ecs_char'",
"Last failure for new () - FAIL");
-is (Text::CSV::error_diag (bless {}, "Foo") . '', "Unknown attribute 'ecs_char'",
+is (Text::CSV::error_diag (bless {}, "Foo") . '', "INI - Unknown attribute 'ecs_char'",
"Last failure for new () - FAIL");
$csv->SetDiag (0);
@@ -97,7 +97,7 @@
is (Text::CSV::Subclass->new ({ ecs_char => ":" }), undef, "Unsupported option");
is (Text::CSV::Subclass->error_diag() . '',
- "Unknown attribute 'ecs_char'", "Last failure for new () - FAIL");
+ "INI - Unknown attribute 'ecs_char'", "Last failure for new () - FAIL");
1;
More information about the Pkg-perl-cvs-commits
mailing list