Hello community,
here is the log from the commit of package perl-Text-CSV_XS for
openSUSE:Factory checked in at 2019-03-24 14:56:46
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/perl-Text-CSV_XS (Old)
and /work/SRC/openSUSE:Factory/.perl-Text-CSV_XS.new.25356 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "perl-Text-CSV_XS"
Sun Mar 24 14:56:46 2019 rev:39 rq:686435 version:1.39
Changes:
--------
--- /work/SRC/openSUSE:Factory/perl-Text-CSV_XS/perl-Text-CSV_XS.changes
2018-10-04 18:57:22.475485126 +0200
+++
/work/SRC/openSUSE:Factory/.perl-Text-CSV_XS.new.25356/perl-Text-CSV_XS.changes
2019-03-24 14:56:47.483203393 +0100
@@ -1,0 +2,20 @@
+Mon Mar 18 09:28:19 UTC 2019 - Pedro Monreal Gonzalez
<[email protected]>
+
+- update to 1.39
+ 1.39 - 2019-03-15, H.Merijn Brand
+ * It's 2019
+ * Fix tests to skip on Encode failing (PR#17 charsbar + klapperl)
+ * Tested on Z/OS (s390x - Hercules) :)
+ * Test with new Module::CPANTS::Analyse
+ * Add options -w/-b/-Z to csvdiff
+ * Fix strict on streaming EOF
+ * Now also tested with cperl
+
+ 1.38 - 2018-12-30, H.Merijn Brand
+ * Name the duplicate headers on error 1013
+ * Add missing attributes to default list (doc only, David H. Gutteridge)
+ * Add support for combined keys
+ * Look at $NO_COLOR for csvdiff
+ * Add support for key-value pair
+
+-------------------------------------------------------------------
Old:
----
Text-CSV_XS-1.37.tgz
New:
----
Text-CSV_XS-1.39.tgz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ perl-Text-CSV_XS.spec ++++++
--- /var/tmp/diff_new_pack.nNkDTY/_old 2019-03-24 14:56:47.995203339 +0100
+++ /var/tmp/diff_new_pack.nNkDTY/_new 2019-03-24 14:56:47.995203339 +0100
@@ -1,7 +1,7 @@
#
# spec file for package perl-Text-CSV_XS
#
-# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -12,12 +12,12 @@
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
-# Please submit bugfixes or comments via http://bugs.opensuse.org/
+# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
Name: perl-Text-CSV_XS
-Version: 1.37
+Version: 1.39
Release: 0
%define cpan_name Text-CSV_XS
Summary: Comma-Separated Values Manipulation Routines
++++++ Text-CSV_XS-1.37.tgz -> Text-CSV_XS-1.39.tgz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Text-CSV_XS-1.37/CSV_XS.pm
new/Text-CSV_XS-1.39/CSV_XS.pm
--- old/Text-CSV_XS-1.37/CSV_XS.pm 2018-09-13 14:25:13.000000000 +0200
+++ new/Text-CSV_XS-1.39/CSV_XS.pm 2019-02-27 10:03:20.000000000 +0100
@@ -1,6 +1,6 @@
package Text::CSV_XS;
-# Copyright (c) 2007-2018 H.Merijn Brand. All rights reserved.
+# Copyright (c) 2007-2019 H.Merijn Brand. All rights reserved.
# Copyright (c) 1998-2001 Jochen Wiedmann. All rights reserved.
# Copyright (c) 1997 Alan Citterman. All rights reserved.
#
@@ -26,7 +26,7 @@
use Carp;
use vars qw( $VERSION @ISA @EXPORT_OK );
-$VERSION = "1.37";
+$VERSION = "1.39";
@ISA = qw( Exporter );
@EXPORT_OK = qw( csv );
XSLoader::load "Text::CSV_XS", $VERSION;
@@ -430,6 +430,15 @@
$self->{strict};
} # always_quote
+sub _SetDiagInfo {
+ my ($self, $err, $msg) = @_;
+ $self->SetDiag ($err);
+ my $em = $self->error_diag;
+ $em =~ s/^\d+$// and $msg =~ s/^/# /;
+ my $sep = $em =~ m/[;\n]$/ ? "\n\t" : ": ";
+ join $sep => grep m/\S\S\S/ => $em, $msg;
+ } # _SetDiagInfo
+
sub _supported_formula {
my ($self, $f) = @_;
defined $f or return 5;
@@ -440,8 +449,7 @@
$f =~ m/^(?: 4 | empty | )$/xi ? 4 :
$f =~ m/^(?: 5 | undef )$/xi ? 5 : do {
$self ||= "Text::CSV_XS";
- $self->SetDiag (1500);
- croak "formula-handling '$f' is not supported\n";
+ croak ($self->_SetDiagInfo (1500, "formula-handling '$f' is not
supported"));
};
} # _supported_formula
@@ -843,7 +851,7 @@
if (defined $args{sep_set}) {
ref $args{sep_set} eq "ARRAY" or
- croak ($self->SetDiag (1500, "sep_set should be an array ref"));
+ croak ($self->_SetDiagInfo (1500, "sep_set should be an array
ref"));
@seps = @{$args{sep_set}};
}
@@ -920,9 +928,12 @@
@hdr = map { $args{munge_column_names}->($_) } @hdr;
ref $args{munge_column_names} eq "HASH" and
@hdr = map { $args{munge_column_names}->{$_} || $_ } @hdr;
- my %hdr = map { $_ => 1 } @hdr;
- exists $hdr{""} and croak ($self->SetDiag (1012));
- keys %hdr == @hdr or croak ($self->SetDiag (1013));
+ my %hdr; $hdr{$_}++ for @hdr;
+ exists $hdr{""} and croak ($self->SetDiag (1012));
+ unless (keys %hdr == @hdr) {
+ croak ($self->_SetDiagInfo (1013, join ", " =>
+ map { "$_ ($hdr{$_})" } grep { $hdr{$_} > 1 } keys %hdr));
+ }
$args{set_column_names} and $self->column_names (@hdr);
wantarray ? @hdr : $self;
} # header
@@ -1158,6 +1169,7 @@
my $hdrs = delete $attr{headers};
my $frag = delete $attr{fragment};
my $key = delete $attr{key};
+ my $val = delete $attr{value};
my $kh = delete $attr{keep_headers} ||
delete $attr{keep_column_names} ||
delete $attr{kh};
@@ -1217,6 +1229,7 @@
enc => $enc,
hdrs => $hdrs,
key => $key,
+ val => $val,
kh => $kh,
frag => $frag,
fltr => $fltr,
@@ -1300,15 +1313,20 @@
}
if ($c->{kh}) {
- ref $c->{kh} eq "ARRAY" or croak ($csv->SetDiag (1501, "1501 - PRM"));
+ ref $c->{kh} eq "ARRAY" or croak ($csv->SetDiag (1501));
$hdrs ||= "auto";
}
my $key = $c->{key};
if ($key) {
- ref $key and croak ($csv->SetDiag (1501, "1501 - PRM"));
+ !ref $key or ref $key eq "ARRAY" && @$key > 1 or croak ($csv->SetDiag
(1501));
$hdrs ||= "auto";
}
+ my $val = $c->{val};
+ if ($val) {
+ $key or croak ($csv->SetDiag
(1502));
+ !ref $val or ref $val eq "ARRAY" && @$val > 0 or croak ($csv->SetDiag
(1503));
+ }
$c->{fltr} && grep m/\D/ => keys %{$c->{fltr}} and $hdrs ||= "auto";
if (defined $hdrs) {
@@ -1363,9 +1381,30 @@
my $ref = ref $hdrs
? # aoh
do {
- $csv->column_names ($hdrs);
+ my @h = $csv->column_names ($hdrs);
+ my %h; $h{$_}++ for @h;
+ exists $h{""} and croak ($csv->SetDiag (1012));
+ unless (keys %h == @h) {
+ croak ($csv->_SetDiagInfo (1013, join ", " =>
+ map { "$_ ($h{$_})" } grep { $h{$_} > 1 } keys %h));
+ }
$frag ? $csv->fragment ($fh, $frag) :
- $key ? { map { $_->{$key} => $_ } @{$csv->getline_hr_all ($fh)} }
+ $key ? do {
+ my ($k, $j, @f) = ref $key ? (undef, @$key) : ($key);
+ if (my @mk = grep { !exists $h{$_} } grep { defined }
$k, @f) {
+ croak ($csv->_SetDiagInfo (4001, join ", " => @mk));
+ }
+ +{ map {
+ my $r = $_;
+ my $K = defined $k ? $r->{$k} : join $j =>
@{$r}{@f};
+ ( $K => (
+ $val
+ ? ref $val
+ ? { map { $_ => $r->{$_} } @$val }
+ : $r->{$val}
+ : $r ));
+ } @{$csv->getline_hr_all ($fh)} }
+ }
: $csv->getline_hr_all ($fh);
}
: # aoa
@@ -2187,6 +2226,8 @@
This attribute is useful when exporting CSV data to be imported in custom
loaders, like for MySQL, that recognize special sequences for C<NULL> data.
+This attribute has no meaning when parsing CSV data.
+
=head3 verbatim
X<verbatim>
@@ -2265,6 +2306,8 @@
escape_null => 1,
quote_binary => 1,
keep_meta_info => 0,
+ strict => 0,
+ formula => 0,
verbatim => 0,
undef_str => undef,
types => undef,
@@ -3296,9 +3339,12 @@
X<key>
If passed, will default L<C<headers>|/headers> to C<"auto"> and return a
-hashref instead of an array of hashes.
+hashref instead of an array of hashes. Allowed values are simple scalars or
+array-references where the first element is the joiner and the rest are the
+fields to join to combine the key.
my $ref = csv (in => "test.csv", key => "code");
+ my $ref = csv (in => "test.csv", key => [ ":" => "code", "color" ]);
with test.csv like
@@ -3307,7 +3353,7 @@
2,keyboard,12,white
3,mouse,5,black
-will return
+the first example will return
{ 1 => {
code => 1,
@@ -3329,6 +3375,28 @@
}
}
+the second example will return
+
+ { "1:gray" => {
+ code => 1,
+ color => 'gray',
+ price => 850,
+ product => 'pc'
+ },
+ "2:white" => {
+ code => 2,
+ color => 'white',
+ price => 12,
+ product => 'keyboard'
+ },
+ "3:black" => {
+ code => 3,
+ color => 'black',
+ price => 5,
+ product => 'mouse'
+ }
+ }
+
The C<key> attribute can be combined with L<C<headers>|/headers> for C<CSV>
date that has no header line, like
@@ -3338,6 +3406,77 @@
key => "c_foo",
);
+=head3 value
+X<value>
+
+Used to create key-value hashes.
+
+Only allowed when C<key> is valid. A C<value> can be either a single column
+label or an anonymous list of column labels. In the first case, the value
+will be a simple scalar value, in the latter case, it will be a hashref.
+
+ my $ref = csv (in => "test.csv", key => "code",
+ value => "price");
+ my $ref = csv (in => "test.csv", key => "code",
+ value => [ "product", "price" ]);
+ my $ref = csv (in => "test.csv", key => [ ":" => "code", "color" ],
+ value => "price");
+ my $ref = csv (in => "test.csv", key => [ ":" => "code", "color" ],
+ value => [ "product", "price" ]);
+
+with test.csv like
+
+ code,product,price,color
+ 1,pc,850,gray
+ 2,keyboard,12,white
+ 3,mouse,5,black
+
+the first example will return
+
+ { 1 => 850,
+ 2 => 12,
+ 3 => 5,
+ }
+
+the second example will return
+
+ { 1 => {
+ price => 850,
+ product => 'pc'
+ },
+ 2 => {
+ price => 12,
+ product => 'keyboard'
+ },
+ 3 => {
+ price => 5,
+ product => 'mouse'
+ }
+ }
+
+the third example will return
+
+ { "1:gray" => 850,
+ "2:white" => 12,
+ "3:black" => 5,
+ }
+
+the fourth example will return
+
+ { "1:gray" => {
+ price => 850,
+ product => 'pc'
+ },
+ "2:white" => {
+ price => 12,
+ product => 'keyboard'
+ },
+ "3:black" => {
+ price => 5,
+ product => 'mouse'
+ }
+ }
+
=head3 keep_headers
X<keep_headers>
X<keep_column_names>
@@ -3949,6 +4088,8 @@
another C<\>, which will cause the field to need quotation and thus ending
up as C<"\\N"> instead of C<\N>. See also L<C<undef_str>|/undef_str>.
+ csv (out => "foo.csv", in => sub { $sth->fetch }, undef_str => "\\N");
+
these special sequences are not recognized by Text::CSV_XS on parsing the
CSV generated like this, but map and filter are your friends again
@@ -4324,6 +4465,18 @@
The C<key> attribute is of an unsupported type.
=item *
+1502 "PRM - The value attribute is passed without the key attribute"
+X<1502>
+
+The C<value> attribute is only allowed when a valid key is given.
+
+=item *
+1503 "PRM - The value attribute is passed as an unsupported type"
+X<1503>
+
+The C<value> attribute is of an unsupported type.
+
+=item *
2010 "ECR - QUO char inside quotes followed by CR not part of EOL"
X<2010>
@@ -4394,7 +4547,7 @@
An escape character should escape only characters that need escaping.
Allowing the escape for other characters is possible with the attribute
-L</allow_loose_escape>.
+L</allow_loose_escapes>.
=item *
2026 "EIQ - Binary character inside quoted field, binary off"
@@ -4520,7 +4673,7 @@
=head1 COPYRIGHT AND LICENSE
- Copyright (C) 2007-2018 H.Merijn Brand. All rights reserved.
+ Copyright (C) 2007-2019 H.Merijn Brand. All rights reserved.
Copyright (C) 1998-2001 Jochen Wiedmann. All rights reserved.
Copyright (C) 1997 Alan Citterman. All rights reserved.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Text-CSV_XS-1.37/CSV_XS.xs
new/Text-CSV_XS-1.39/CSV_XS.xs
--- old/Text-CSV_XS-1.37/CSV_XS.xs 2018-09-27 11:52:22.000000000 +0200
+++ new/Text-CSV_XS-1.39/CSV_XS.xs 2019-03-14 17:00:17.000000000 +0100
@@ -1,4 +1,4 @@
-/* Copyright (c) 2007-2018 H.Merijn Brand. All rights reserved.
+/* Copyright (c) 2007-2019 H.Merijn Brand. All rights reserved.
* Copyright (c) 1998-2001 Jochen Wiedmann. All rights reserved.
* This program is free software; you can redistribute it and/or
* modify it under the same terms as Perl itself.
@@ -212,6 +212,8 @@
/* Syntax errors */
{ 1500, "PRM - Invalid/unsupported argument(s)"
},
{ 1501, "PRM - The key attribute is passed as an unsupported type"
},
+ { 1502, "PRM - The value attribute is passed without the key attribute"
},
+ { 1503, "PRM - The value attribute is passed as an unsupported type"
},
/* Parse errors */
{ 2010, "ECR - QUO char inside quotes followed by CR not part of EOL"
},
@@ -255,6 +257,8 @@
{ 3009, "EHR - print_hr () called before column_names ()"
},
{ 3010, "EHR - print_hr () called with invalid arguments"
},
+ { 4001, "PRM - The key does not exist as field in the data"
},
+
{ 0, "" },
};
@@ -346,12 +350,10 @@
(void)hv_store (csv->self, "_EOF", 4, &PL_sv_yes, 0);
if (csv->pself && csv->auto_diag) {
ENTER;
- SAVETMPS;
PUSHMARK (SP);
XPUSHs (csv->pself);
PUTBACK;
call_pv ("Text::CSV_XS::error_diag", G_VOID | G_DISCARD);
- FREETMPS;
LEAVE;
}
return (err);
@@ -1817,7 +1819,8 @@
if (csv.strict) {
unless (csv.strict_n) csv.strict_n = (short)csv.fld_idx;
if (csv.fld_idx != csv.strict_n) {
- ParseError (&csv, 2014, csv.used);
+ unless (csv.useIO & useIO_EOF)
+ ParseError (&csv, 2014, csv.used);
result = FALSE;
}
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Text-CSV_XS-1.37/ChangeLog
new/Text-CSV_XS-1.39/ChangeLog
--- old/Text-CSV_XS-1.37/ChangeLog 2018-09-27 11:40:09.000000000 +0200
+++ new/Text-CSV_XS-1.39/ChangeLog 2019-03-15 12:17:57.000000000 +0100
@@ -1,3 +1,19 @@
+1.39 - 2019-03-15, H.Merijn Brand
+ * It's 2019
+ * Fix tests to skip on Encode failing (PR#17 charsbar + klapperl)
+ * Tested on Z/OS (s390x - Hercules) :)
+ * Test with new Module::CPANTS::Analyse
+ * Add options -w/-b/-Z to csvdiff
+ * Fix strict on streaming EOF
+ * Now also tested with cperl
+
+1.38 - 2018-12-30, H.Merijn Brand
+ * Name the duplicate headers on error 1013
+ * Add missing attributes to default list (doc only, David H. Gutteridge)
+ * Add support for combined keys
+ * Look at $NO_COLOR for csvdiff
+ * Add support for key-value pair
+
1.37 - 2018-09-27, H.Merijn Brand
* Moved pod-tests from t to xt
* Add munge as alias for munge_column_names
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Text-CSV_XS-1.37/META.json
new/Text-CSV_XS-1.39/META.json
--- old/Text-CSV_XS-1.37/META.json 2018-09-27 13:43:25.000000000 +0200
+++ new/Text-CSV_XS-1.39/META.json 2019-03-16 10:50:55.000000000 +0100
@@ -1,64 +1,64 @@
{
- "abstract" : "Comma-Separated Values manipulation routines",
+ "dynamic_config" : 1,
+ "release_status" : "stable",
+ "prereqs" : {
+ "configure" : {
+ "requires" : {
+ "ExtUtils::MakeMaker" : "0"
+ }
+ },
+ "build" : {
+ "requires" : {
+ "Config" : "0"
+ }
+ },
+ "runtime" : {
+ "requires" : {
+ "perl" : "5.006001",
+ "XSLoader" : "0",
+ "IO::Handle" : "0"
+ },
+ "recommends" : {
+ "Encode" : "3.01"
+ }
+ },
+ "test" : {
+ "requires" : {
+ "Test::More" : "0",
+ "Tie::Scalar" : "0"
+ }
+ }
+ },
+ "version" : "1.39",
+ "generated_by" : "Author",
+ "provides" : {
+ "Text::CSV_XS" : {
+ "version" : "1.39",
+ "file" : "CSV_XS.pm"
+ }
+ },
"meta-spec" : {
"url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
"version" : 2
- },
+ },
+ "name" : "Text-CSV_XS",
+ "license" : [
+ "perl_5"
+ ],
"author" : [
"H.Merijn Brand <[email protected]>"
- ],
- "provides" : {
- "Text::CSV_XS" : {
- "file" : "CSV_XS.pm",
- "version" : "1.37"
- }
- },
- "name" : "Text-CSV_XS",
- "generated_by" : "Author",
- "release_status" : "stable",
+ ],
"resources" : {
"license" : [
"http://dev.perl.org/licenses/"
- ],
+ ],
+ "homepage" : "https://metacpan.org/pod/Text::CSV_XS",
"x_IRC" : "irc://irc.perl.org/#csv",
"repository" : {
"url" : "https://github.com/Tux/Text-CSV_XS",
"web" : "https://github.com/Tux/Text-CSV_XS",
"type" : "git"
- },
- "homepage" : "https://metacpan.org/pod/Text::CSV_XS"
- },
- "prereqs" : {
- "build" : {
- "requires" : {
- "Config" : "0"
- }
- },
- "test" : {
- "requires" : {
- "Tie::Scalar" : "0",
- "Test::More" : "0"
- }
- },
- "configure" : {
- "requires" : {
- "ExtUtils::MakeMaker" : "0"
}
},
- "runtime" : {
- "requires" : {
- "XSLoader" : "0",
- "IO::Handle" : "0",
- "perl" : "5.006001"
- },
- "recommends" : {
- "Encode" : "2.98"
- }
- }
- },
- "dynamic_config" : 1,
- "version" : "1.37",
- "license" : [
- "perl_5"
- ]
-}
+ "abstract" : "Comma-Separated Values manipulation routines"
+ }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Text-CSV_XS-1.37/META.yml
new/Text-CSV_XS-1.39/META.yml
--- old/Text-CSV_XS-1.37/META.yml 2018-09-27 13:43:25.000000000 +0200
+++ new/Text-CSV_XS-1.39/META.yml 2019-03-16 10:50:55.000000000 +0100
@@ -16,9 +16,9 @@
provides:
Text::CSV_XS:
file: CSV_XS.pm
- version: '1.37'
+ version: '1.39'
recommends:
- Encode: '2.98'
+ Encode: '3.01'
requires:
IO::Handle: 0
Test::More: 0
@@ -30,4 +30,4 @@
homepage: https://metacpan.org/pod/Text::CSV_XS
license: http://dev.perl.org/licenses/
repository: https://github.com/Tux/Text-CSV_XS
-version: '1.37'
+version: '1.39'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Text-CSV_XS-1.37/Makefile.PL
new/Text-CSV_XS-1.39/Makefile.PL
--- old/Text-CSV_XS-1.37/Makefile.PL 2018-07-03 09:36:42.000000000 +0200
+++ new/Text-CSV_XS-1.39/Makefile.PL 2019-01-01 17:41:44.000000000 +0100
@@ -1,6 +1,6 @@
#!/usr/bin/perl
-# Copyright PROCURA B.V. (c) 2006-2018 H.Merijn Brand
+# Copyright PROCURA B.V. (c) 2006-2019 H.Merijn Brand
require 5.006001; # <- also see postamble at the bottom for META.yml
use strict;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Text-CSV_XS-1.37/README new/Text-CSV_XS-1.39/README
--- old/Text-CSV_XS-1.37/README 2018-07-03 09:36:42.000000000 +0200
+++ new/Text-CSV_XS-1.39/README 2019-01-01 17:41:48.000000000 +0100
@@ -7,7 +7,7 @@
combine fields into a CSV string and parse a CSV string into fields.
Copying:
- Copyright (c) 2007-2018 H.Merijn Brand. All rights reserved.
+ Copyright (c) 2007-2019 H.Merijn Brand. All rights reserved.
Copyright (c) 1998-2001 Jochen Wiedmann. All rights reserved.
Portions Copyright (c) 1997 Alan Citterman. All rights reserved.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Text-CSV_XS-1.37/examples/csv-check
new/Text-CSV_XS-1.39/examples/csv-check
--- old/Text-CSV_XS-1.37/examples/csv-check 2018-07-03 09:36:42.000000000
+0200
+++ new/Text-CSV_XS-1.39/examples/csv-check 2019-01-01 17:41:39.000000000
+0100
@@ -1,7 +1,7 @@
#!/pro/bin/perl
# csv-check: Check validity of CSV file and report
-# (m)'17 [24 Nov 2017] Copyright H.M.Brand 2007-2018
+# (m)'17 [24 Nov 2017] Copyright H.M.Brand 2007-2019
# This code requires the defined-or feature and PerlIO
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Text-CSV_XS-1.37/examples/csv2xls
new/Text-CSV_XS-1.39/examples/csv2xls
--- old/Text-CSV_XS-1.37/examples/csv2xls 2018-07-03 09:36:42.000000000
+0200
+++ new/Text-CSV_XS-1.39/examples/csv2xls 2019-01-01 17:41:40.000000000
+0100
@@ -1,7 +1,7 @@
#!/pro/bin/perl
# csv2xls: Convert csv to xls
-# (m)'17 [18 Oct 2017] Copyright H.M.Brand 2007-2018
+# (m)'17 [18 Oct 2017] Copyright H.M.Brand 2007-2019
use 5.12.0;
use warnings;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Text-CSV_XS-1.37/examples/csv2xlsx
new/Text-CSV_XS-1.39/examples/csv2xlsx
--- old/Text-CSV_XS-1.37/examples/csv2xlsx 2018-07-03 09:36:42.000000000
+0200
+++ new/Text-CSV_XS-1.39/examples/csv2xlsx 2019-01-01 17:41:41.000000000
+0100
@@ -1,7 +1,7 @@
#!/pro/bin/perl
# csv2xlsx: Convert csv to xlsx
-# (m)'17 [20 Oct 2017] Copyright H.M.Brand 2007-2018
+# (m)'17 [20 Oct 2017] Copyright H.M.Brand 2007-2019
use 5.14.0;
use warnings;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Text-CSV_XS-1.37/examples/csvdiff
new/Text-CSV_XS-1.39/examples/csvdiff
--- old/Text-CSV_XS-1.37/examples/csvdiff 2017-09-05 18:26:38.000000000
+0200
+++ new/Text-CSV_XS-1.39/examples/csvdiff 2019-03-05 13:54:09.000000000
+0100
@@ -3,25 +3,36 @@
use strict;
use warnings;
+our $VERSION = "1.02 - 20190305";
+
sub usage {
my $err = shift and select STDERR;
- print "usage: csvdiff [--no-color] [--html] file.csv file.csv\n",
+ print "usage: csvdiff [--no-color] [--html] [-w|-b|-Z] file.csv
file.csv\n",
" provides colorized diff on sorted CSV files\n",
- " assuming first line is header and first field is the key\n";
+ " assuming first line is header and first field is the key\n",
+ " --no-color do not use colors\n",
+ " -h --html produce HTML output\n",
+ " -w --ignore-all-space ignore all whistespace is all
fields\n",
+ " -b --ignore-space-change ignore whitespace length changes\n",
+ " -Z --ignore-trailing-space ignore trailing whitespace per
field\n",
+ " -o F --output=F send output to file F\n";
exit $err;
} # usage
use Getopt::Long qw(:config bundling nopermute );
-my $opt_c = 1;
-my $opt_h = 0;
-my $opt_o = "";
+my $opt_c = !$ENV{NO_COLOR};
GetOptions (
"help|?" => sub { usage (0); },
+ "V|version" => sub { print "csvdiff [$VERSION]\n"; exit 0 },
+
+ "w|ignore-all-space!" => \my $opt_w,
+ "b|ignore-ws|ignore-space-change!" => \my $opt_b,
+ "Z|ignore-trailing-space!" => \my $opt_Z,
- "c|color|colour!" => \$opt_c,
- "h|html" => \$opt_h,
+ "c|color|colour!" => \ $opt_c,
+ "h|html" => \my $opt_h,
- "o|output=s" => \$opt_o,
+ "o|output=s" => \my $opt_o,
) or usage (1);
@ARGV == 2 or usage (1);
@@ -99,7 +110,7 @@
sub show {
my ($pfx, $x) = @_;
- my $row = $f[$x][$i[$x]++];
+ my $row = $f[$x][$i[$x]++] or return;
if ($opt_h) {
my $bg = $cls{$pfx}->();
@@ -141,7 +152,15 @@
$r0[0] gt $r1[0] and show ("+", 1), next;
}
- "@r0" eq "@r1" and $i[0]++, $i[1]++, next;
+ my @v0 = @r0;
+ my @v1 = @r1;
+ $opt_Z and s/[\r\n\s]+\z// for @v0, @v1;
+ $opt_b and s/[\r\n\s]+/ /g for @v0, @v1;
+ $opt_w and s/[\r\n\s]+//g for @v0, @v1;
+
+ { local $" = "\xFF";
+ "@v0" eq "@v1" and $i[0]++, $i[1]++, next;
+ }
foreach my $c (1 .. $#h0) {
my ($L, $R) = map { $_ // "" } $r0[$c], $r1[$c];
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Text-CSV_XS-1.37/examples/parser-xs.pl
new/Text-CSV_XS-1.39/examples/parser-xs.pl
--- old/Text-CSV_XS-1.37/examples/parser-xs.pl 2018-07-03 09:36:42.000000000
+0200
+++ new/Text-CSV_XS-1.39/examples/parser-xs.pl 2019-01-01 17:41:42.000000000
+0100
@@ -3,7 +3,7 @@
# This script can be used as a base to parse unreliable CSV streams
# Modify to your own needs
#
-# (m)'08 [23 Apr 2008] Copyright H.M.Brand 2008-2018
+# (m)'08 [23 Apr 2008] Copyright H.M.Brand 2008-2019
use strict;
use warnings;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Text-CSV_XS-1.37/examples/speed.pl
new/Text-CSV_XS-1.39/examples/speed.pl
--- old/Text-CSV_XS-1.37/examples/speed.pl 2018-07-03 09:36:42.000000000
+0200
+++ new/Text-CSV_XS-1.39/examples/speed.pl 2019-01-01 17:41:43.000000000
+0100
@@ -1,7 +1,7 @@
#!/usr/bin/perl -w
# speed.pl: compare different versions of Text-CSV* modules
-# (m)'08 [07 Apr 2008] Copyright H.M.Brand 2007-2018
+# (m)'08 [07 Apr 2008] Copyright H.M.Brand 2007-2019
require 5.006001;
use strict;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Text-CSV_XS-1.37/ppport.h
new/Text-CSV_XS-1.39/ppport.h
--- old/Text-CSV_XS-1.37/ppport.h 2018-09-19 17:18:48.000000000 +0200
+++ new/Text-CSV_XS-1.39/ppport.h 2019-03-14 17:42:38.000000000 +0100
@@ -4,9 +4,9 @@
/*
----------------------------------------------------------------------
- ppport.h -- Perl/Pollution/Portability Version 3.43
+ ppport.h -- Perl/Pollution/Portability Version 3.44
- Automatically created by Devel::PPPort running under perl 5.028000.
+ Automatically created by Devel::PPPort running under perl 5.028001.
Do NOT edit this file directly! -- Edit PPPort_pm.PL and the
includes in parts/inc/ instead.
@@ -21,7 +21,7 @@
=head1 NAME
-ppport.h - Perl/Pollution/Portability version 3.43
+ppport.h - Perl/Pollution/Portability version 3.44
=head1 SYNOPSIS
@@ -389,7 +389,7 @@
# Disable broken TRIE-optimization
BEGIN { eval '${^RE_TRIE_MAXBUF} = -1' if "$]" >= 5.009004 && "$]" <= 5.009005
}
-my $VERSION = 3.43;
+my $VERSION = 3.44;
my %opt = (
quiet => 0,
@@ -4585,8 +4585,8 @@
# if ( (PERL_BCDVERSION >= 0x5008000) && (PERL_BCDVERSION < 0x5008009) ) || (
(PERL_BCDVERSION >= 0x5009000) && (PERL_BCDVERSION < 0x5010001) )
# define D_PPP_FIX_UTF8_ERRSV(errsv, sv) \
STMT_START { \
- if (sv != ERRSV) \
- SvFLAGS(ERRSV) = (SvFLAGS(ERRSV) & ~SVf_UTF8) | \
+ if (sv != errsv) \
+ SvFLAGS(errsv) = (SvFLAGS(errsv) & ~SVf_UTF8) | \
(SvFLAGS(sv) & SVf_UTF8); \
} STMT_END
# else
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Text-CSV_XS-1.37/t/66_formula.t
new/Text-CSV_XS-1.39/t/66_formula.t
--- old/Text-CSV_XS-1.37/t/66_formula.t 2018-07-03 09:36:42.000000000 +0200
+++ new/Text-CSV_XS-1.39/t/66_formula.t 2018-11-07 13:32:23.000000000 +0100
@@ -38,7 +38,7 @@
foreach my $f (-1, 9, "xxx", "DIAX", [], {}, sub {}) {
eval { $csv->formula ($f); };
- like ($@, qr/^formula-handling '\Q$f\E' is not supported/, "$f in
invalid");
+ like ($@, qr/\bformula-handling '\Q$f\E' is not supported/, "$f in
invalid");
}
my %f = qw(
@@ -54,7 +54,7 @@
is ($p->formula, $f{$f}, "Set to $f{$f}");
}
eval { Text::CSV_XS->new ({ formula => "xxx" }); };
-like ($@, qr/^formula-handling 'xxx' is not supported/, "xxx in invalid");
+like ($@, qr/\bformula-handling 'xxx' is not supported/, "xxx is invalid");
# Parser
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Text-CSV_XS-1.37/t/80_diag.t
new/Text-CSV_XS-1.39/t/80_diag.t
--- old/Text-CSV_XS-1.37/t/80_diag.t 2018-08-09 13:37:36.000000000 +0200
+++ new/Text-CSV_XS-1.39/t/80_diag.t 2019-03-14 16:59:15.000000000 +0100
@@ -3,7 +3,7 @@
use strict;
use warnings;
- use Test::More tests => 289;
+ use Test::More tests => 317;
#use Test::More "no_plan";
my %err;
@@ -20,6 +20,7 @@
close $fh;
}
+my $tfn = "_80test.csv"; END { -f $tfn and unlink $tfn; }
$| = 1;
my $csv = Text::CSV_XS->new ();
@@ -262,6 +263,32 @@
is ($csv->parse ("3,4,5,6"), 0, "Too many columns");
is (0 + $csv->error_diag, 2014, "Error set correctly");
}
+{ my $csv = Text::CSV_XS->new ({ strict => 1 });
+ open my $fh, ">", $tfn or die "$tfn: $!\n";
+ ok ($csv->say ($fh, [ 1, 2, 3 ]), "Write line 1");
+ ok ($csv->say ($fh, [ 1, 2, 3 ]), "Write line 2");
+ close $fh;
+ open $fh, "<", $tfn or die "$tfn: $!\n";
+ ok ((my $r = $csv->getline ($fh)), "Get line 1 under strict");
+ ok (( $r = $csv->getline ($fh)), "Get line 2 under strict");
+ is ($csv->getline ($fh), undef, "EOF under strict");
+ is (0 + $csv->error_diag, 2012, "Error is 2012 instead of 2014");
+ ok ($csv->eof, "EOF is set");
+ close $fh;
+ }
+{ my $csv = Text::CSV_XS->new ({ strict => 1 });
+ open my $fh, ">", $tfn or die "$tfn: $!\n";
+ ok ($csv->say ($fh, [ 1, 2, 3 ]), "Write line 1");
+ ok ($csv->print ($fh, [ 1, 2, 3 ]), "Write line 2 no newline");
+ close $fh;
+ open $fh, "<", $tfn or die "$tfn: $!\n";
+ ok ((my $r = $csv->getline ($fh)), "Get line 1 under strict");
+ ok (( $r = $csv->getline ($fh)), "Get line 2 under strict no newline");
+ is ($csv->getline ($fh), undef, "EOF under strict");
+ is (0 + $csv->error_diag, 2012, "Error is 2012 instead of 2014");
+ ok ($csv->eof, "EOF is set");
+ close $fh;
+ }
{ my $csv = Text::CSV_XS->new;
eval { $csv->header (undef, "foo"); };
@@ -279,4 +306,30 @@
}
}
+SKIP: {
+ $] < 5.008 and skip qq{$] does not support ScalarIO}, 14;
+ foreach my $key ({}, sub {}, []) {
+ my $csv = Text::CSV_XS->new;
+ my $x = eval { $csv->csv (in => \"a,b", key => $key) };
+ is ($x, undef, "Invalid key");
+ my @diag = $csv->error_diag;
+ is ($diag[0], 1501, "Invalid key type");
+ }
+
+ { my $csv = Text::CSV_XS->new;
+ my $x = eval { $csv->csv (in => \"a,b", value => "b") };
+ is ($x, undef, "Value without key");
+ my @diag = $csv->error_diag;
+ is ($diag[0], 1502, "No key");
+ }
+
+ foreach my $val ({}, sub {}, []) {
+ my $csv = Text::CSV_XS->new;
+ my $x = eval { $csv->csv (in => \"a,b", key => "a", value => $val) };
+ is ($x, undef, "Invalid value");
+ my @diag = $csv->error_diag;
+ is ($diag[0], 1503, "Invalid value type");
+ }
+ }
+
1;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Text-CSV_XS-1.37/t/85_util.t
new/Text-CSV_XS-1.39/t/85_util.t
--- old/Text-CSV_XS-1.37/t/85_util.t 2018-07-03 09:36:42.000000000 +0200
+++ new/Text-CSV_XS-1.39/t/85_util.t 2019-01-02 13:57:13.000000000 +0100
@@ -14,12 +14,16 @@
plan skip_all => "This test unit requires perl-5.8.2 or higher";
}
else {
- my $n = 1370;
+ my $n = 1442;
$pu and $n -= 120;
plan tests => $n;
}
use_ok "Text::CSV_XS", "csv";
+ # Encode up to and including 2.01 have an error in a regex:
+ # False [] range "\s-" in regex; marked by <-- HERE in m/\bkoi8[\s- <--
HERE _]*([ru])$/
+ # in Encode::Alias. This however does not influence this test, as then
*all* encodings
+ # are skipped as unsupported
require Encode;
require "./t/util.pl";
}
@@ -249,17 +253,18 @@
qq{1,"1 \x{20ac} each"},
"";
for ( [ "none" => "" ],
- [ "utf-8" => "\xef\xbb\xbf" ],
+ [ "utf-8" => "\xef\xbb\xbf" ],
[ "utf-16be" => "\xfe\xff" ],
[ "utf-16le" => "\xff\xfe" ],
[ "utf-32be" => "\x00\x00\xfe\xff" ],
[ "utf-32le" => "\xff\xfe\x00\x00" ],
- # Below not (yet) supported by Encode
- [ "utf-1" => "\xf7\x64\x4c" ],
+ # Below 5 not (yet) supported by Encode
+ [ "utf-1" => "\xf7\x64\x4c" ],
[ "utf-ebcdic" => "\xdd\x73\x66\x73" ],
- [ "scsu" => "\x0e\xfe\xff" ],
- [ "bocu-1" => "\xfb\xee\x28" ],
- [ "gb-18030" => "\x84\x31\x95" ],
+ [ "scsu" => "\x0e\xfe\xff" ],
+ [ "bocu-1" => "\xfb\xee\x28" ],
+ [ "gb-18030" => "\x84\x31\x95" ],
+ #
[ "UTF-8" => "\x{feff}" ],
) {
my ($enc, $bom) = @$_;
@@ -277,7 +282,7 @@
$csv = Text::CSV_XS->new ({ binary => 1, auto_diag => 9 });
SKIP: {
- $has_enc or skip "Encoding $enc not supported", 7;
+ $has_enc or skip "Encoding $enc not supported", $enc =~ m/^utf/
? 10 : 9;
$csv->column_names (undef);
open my $fh, "<", $fnm;
binmode $fh;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Text-CSV_XS-1.37/t/90_csv.t
new/Text-CSV_XS-1.39/t/90_csv.t
--- old/Text-CSV_XS-1.37/t/90_csv.t 2017-09-16 20:39:50.000000000 +0200
+++ new/Text-CSV_XS-1.39/t/90_csv.t 2019-03-14 17:13:38.000000000 +0100
@@ -5,7 +5,7 @@
use Config;
#use Test::More "no_plan";
- use Test::More tests => 88;
+ use Test::More tests => 105;
BEGIN {
use_ok "Text::CSV_XS", ("csv");
@@ -94,9 +94,15 @@
ok (csv (in => $aoh, out => $tfn, headers => "auto"), "AOH out file");
is_deeply (csv (in => $tfn, headers => "auto"), $aoh, "AOH parse out");
-ok (csv (in => $aoh, out => $tfn, headers => "skip"), "AOH out file no
header");
-is_deeply (csv (in => $tfn, headers => [keys %{$aoh->[0]}]),
- $aoh, "AOH parse out no header");
+if ($Config{usecperl} && $Config{usecperl} eq "define") {
+ ok (1, "cperl has a different view on stable sorting of hash keys");
+ ok (1, "not doing this (silly) test");
+ }
+else {
+ ok (csv (in => $aoh, out => $tfn, headers => "skip"), "AOH out file no
header");
+ is_deeply (csv (in => $tfn, headers => [keys %{$aoh->[0]}]),
+ $aoh, "AOH parse out no header");
+ }
my $idx = 0;
sub getrowa { return $aoa->[$idx++]; }
@@ -116,11 +122,35 @@
# Basic "key" checks
SKIP: {
- $] < 5.008 and skip "No ScalarIO support for $]", 2;
+ $] < 5.008 and skip "No ScalarIO support for $]", 4;
+ # Simple key
is_deeply (csv (in => \"key,value\n1,2\n", key => "key"),
{ 1 => { key => 1, value => 2 }}, "key");
is_deeply (csv (in => \"1,2\n", key => "key", headers => [qw( key value
)]),
{ 1 => { key => 1, value => 2 }}, "key");
+ # Combined key
+ is_deeply (csv (in => \"a,b,value\n1,1,2\n", key => [ ":" => "a", "b" ]),
+ { "1:1" => { a => 1, b => 1, value => 2 }}, "key list");
+ is_deeply (csv (in => \"2,3,2\n", key => [ ":" => "a", "b" ], headers =>
[qw( a b value )]),
+ { "2:3" => { a => 2, b => 3, value => 2 }}, "key list");
+ }
+# Basic "value" checks
+SKIP: {
+ $] < 5.008001 and skip "No ScalarIO support for 'value's in $]", 5;
+ # Simple key simple value
+ is_deeply (csv (in => \"key,value\n1,2\n", key => "key", value => "value"),
+ { 1 => 2 }, "key:value");
+ is_deeply (csv (in => \"1,2\n", key => "key", headers => [qw( key value
)], value => "value"),
+ { 1 => 2 }, "key:value");
+ # Simple key combined value
+ is_deeply (csv (in => \"key,v1,v2\n1,2,3\n", key => "key", value => [
"v1", "v2" ]),
+ { 1 => { v1 => 2, v2 => 3 }}, "key:value");
+ # Combined key simple value
+ is_deeply (csv (in => \"a,b,value\n1,1,2\n", key => [ ":" => "a", "b" ],
value => "value"),
+ { "1:1" => 2 }, "[key]:value");
+ # Combined key combined value
+ is_deeply (csv (in => \"a,b,v1,v2\n1,1,2,2\n", key => [ ":" => "a", "b" ],
value => [ "v1", "v2" ]),
+ { "1:1" => { v1 => 2, v2 => 2 }}, "[key]:[value]");
}
# Some "out" checks
@@ -163,24 +193,56 @@
$] < 5.008 and unlink glob "SCALAR(*)";
# errors
-{ my $err;
+{ my $err = "";
local $SIG{__DIE__} = sub { $err = shift; };
my $r = eval { csv (in => undef); };
is ($r, undef, "csv needs in or file");
like ($err, qr{^usage:}, "error");
- undef $err;
+ $err = "";
- $r = eval { csv (in => $tfn, key => ["foo"], auto_diag => 0); };
- is ($r, undef, "Fail call with bad key type");
- like ($err, qr{1501 - PRM}, "Error 1501");
- undef $err;
+ $r = eval { csv (in => $tfn, key => [ ":" ], auto_diag => 0); };
+ $err =~ s{\s+at\s+\S+\s+line\s+\d+\.\r?\n?\Z}{};
+ is ($r, undef, "Fail call with key with not enough fields");
+ like ($err, qr{PRM.*unsupported type}, $err);
+ $err = "";
+
+ $r = eval { csv (in => $tfn, key => { "fx" => 1 }, auto_diag => 0); };
+ $err =~ s{\s+at\s+\S+\s+line\s+\d+\.\r?\n?\Z}{};
+ is ($r, undef, "Fail call with unsupported key type");
+ like ($err, qr{PRM.*unsupported type}, $err);
+ $err = "";
+
+ $r = eval { csv (in => $tfn, key => sub { "foo" }, auto_diag => 0); };
+ $err =~ s{\s+at\s+\S+\s+line\s+\d+\.\r?\n?\Z}{};
+ is ($r, undef, "Fail call with bad unsupported type");
+ like ($err, qr{PRM.*unsupported type}, $err);
+ $err = "";
+
+ $r = eval { csv (in => $tfn, key => "xyz", auto_diag => 0); };
+ $err =~ s{\s+at\s+\S+\s+line\s+\d+\.\r?\n?\Z}{};
+ is ($r, undef, "Fail call with nonexisting key");
+ like ($err, qr{PRM.*xyz}, $err);
+ $err = "";
+
+ $r = eval { csv (in => $tfn, key => [ "x" ], auto_diag => 0); };
+ $err =~ s{\s+at\s+\S+\s+line\s+\d+\.\r?\n?\Z}{};
+ is ($r, undef, "Fail call with no key in keylist");
+ like ($err, qr{PRM.*unsupported type}, $err);
+ $err = "";
+
+ $r = eval { csv (in => $tfn, key => [ ":", "a", "xyz" ], auto_diag => 0);
};
+ $err =~ s{\s+at\s+\S+\s+line\s+\d+\.\r?\n?\Z}{};
+ is ($r, undef, "Fail call with nonexisting key in keylist");
+ like ($err, qr{PRM.*xyz}, $err);
+ $err = "";
local $SIG{__DIE__} = sub { $err = shift; };
foreach my $hr (1, "foo", \my %hr, sub { 42; }, *STDOUT) {
$r = eval { csv (in => $tfn, kh => $hr, auto_diag => 0); };
+ $err =~ s{\s+at\s+\S+\s+line\s+\d+\.\r?\n?\Z}{};
is ($r, undef, "Fail call with bad keep_header type");
- like ($err, qr{1501 - PRM}, "Error 1501");
- undef $err;
+ like ($err, qr{PRM.*unsupported type}, $err);
+ $err = "";
}
# $r = eval { csv (in => +{}, auto_diag => 0); };
@@ -189,42 +251,49 @@
# undef $err;
$r = eval { csv (in => undef, auto_diag => 0); };
+ $err =~ s{\s+at\s+\S+\s+line\s+\d+\.\r?\n?\Z}{};
is ($r, undef, "Cannot read from undef");
like ($err, qr{^usage}, "Remind them of correct syntax");
- undef $err;
+ $err = "";
$r = eval { csv (in => "", auto_diag => 0); };
+ $err =~ s{\s+at\s+\S+\s+line\s+\d+\.\r?\n?\Z}{};
is ($r, undef, "Cannot read from empty");
like ($err, qr{^usage}, "Remind them of correct syntax");
- undef $err;
+ $err = "";
my $fn = "./dev/foo/bar/\x99\x99/\x88\x88/".
(join "\x99" => map { chr (128 + int rand 128) } 0..100).".csv";
$r = eval { csv (in => $fn, auto_diag => 0); };
+ $err =~ s{\s+at\s+\S+\s+line\s+\d+\.\r?\n?\Z}{};
is ($r, undef, "Cannot read from impossible file");
like ($err, qr{/foo/bar}, "No such file or directory");
- undef $err;
+ $err = "";
$r = eval { csv (in => [[1,2]], out => $fn, auto_diag => 0); };
+ $err =~ s{\s+at\s+\S+\s+line\s+\d+\.\r?\n?\Z}{};
is ($r, undef, "Cannot write to impossible file");
like ($err, qr{/foo/bar}, "No such file or directory");
- undef $err;
+ $err = "";
my %x;
$r = eval { csv (in => $tfn, out => \%x, auto_diag => 0); };
+ $err =~ s{\s+at\s+\S+\s+line\s+\d+\.\r?\n?\Z}{};
is ($r, undef, "Cannot write to hashref");
like ($err, qr{Not a GLOB}i, "Not a GLOB");
- undef $err;
+ $err = "";
$r = eval { csv (); };
+ $err =~ s{\s+at\s+\S+\s+line\s+\d+\.\r?\n?\Z}{};
is ($r, undef, "Needs arguments");
like ($err, qr{^usage}i, "Don't know what to do");
- undef $err;
+ $err = "";
$r = eval { csv (in => "in.csv", out => "out.csv"); };
+ $err =~ s{\s+at\s+\S+\s+line\s+\d+\.\r?\n?\Z}{};
is ($r, undef, "Cannot use strings for both");
like ($err, qr{^cannot}i, "Explicitely unsupported");
- undef $err;
+ $err = "";
}
eval {