Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package perl-Text-CSV_XS for openSUSE:Factory checked in at 2021-04-06 17:29:15 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/perl-Text-CSV_XS (Old) and /work/SRC/openSUSE:Factory/.perl-Text-CSV_XS.new.2401 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "perl-Text-CSV_XS" Tue Apr 6 17:29:15 2021 rev:45 rq:881347 version:1.46 Changes: -------- --- /work/SRC/openSUSE:Factory/perl-Text-CSV_XS/perl-Text-CSV_XS.changes 2020-12-30 17:11:57.244891095 +0100 +++ /work/SRC/openSUSE:Factory/.perl-Text-CSV_XS.new.2401/perl-Text-CSV_XS.changes 2021-04-06 17:30:32.299175120 +0200 @@ -1,0 +2,14 @@ +Thu Mar 25 03:08:52 UTC 2021 - Tina M??ller <timueller+p...@suse.de> + +- updated to 1.46 + see /usr/share/doc/packages/perl-Text-CSV_XS/ChangeLog + + 1.46 - 2021-03-24, H.Merijn Brand + * It's 2021 + * New attribute comment_str (RFC 4180-bis) + * New attribute skip_empty_rows (RFC 4180-bis) + * http -> https in links in docs + * Fix several issues with auto-detecting \r as EOL + * Tested on perl-5.6.1 .. perl-5.32.1 and perl-5.33.8 (145) + +------------------------------------------------------------------- Old: ---- Text-CSV_XS-1.45.tgz New: ---- Text-CSV_XS-1.46.tgz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ perl-Text-CSV_XS.spec ++++++ --- /var/tmp/diff_new_pack.90d0jb/_old 2021-04-06 17:30:32.751175631 +0200 +++ /var/tmp/diff_new_pack.90d0jb/_new 2021-04-06 17:30:32.755175635 +0200 @@ -1,7 +1,7 @@ # # spec file for package perl-Text-CSV_XS # -# Copyright (c) 2020 SUSE LLC +# Copyright (c) 2021 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -18,7 +18,7 @@ %define cpan_name Text-CSV_XS Name: perl-Text-CSV_XS -Version: 1.45 +Version: 1.46 Release: 0 Summary: Comma-separated values manipulation routines License: Artistic-1.0 OR GPL-1.0-or-later ++++++ Text-CSV_XS-1.45.tgz -> Text-CSV_XS-1.46.tgz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Text-CSV_XS-1.45/CSV_XS.pm new/Text-CSV_XS-1.46/CSV_XS.pm --- old/Text-CSV_XS-1.45/CSV_XS.pm 2020-12-22 10:12:11.000000000 +0100 +++ new/Text-CSV_XS-1.46/CSV_XS.pm 2021-03-23 17:39:51.000000000 +0100 @@ -1,6 +1,6 @@ package Text::CSV_XS; -# Copyright (c) 2007-2020 H.Merijn Brand. All rights reserved. +# Copyright (c) 2007-2021 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.45"; +$VERSION = "1.46"; @ISA = qw( Exporter ); @EXPORT_OK = qw( csv ); XSLoader::load ("Text::CSV_XS", $VERSION); @@ -78,7 +78,9 @@ 'keep_meta_info' => 0, 'verbatim' => 0, 'formula' => 0, + 'skip_empty_rows' => 0, 'undef_str' => undef, + 'comment_str' => undef, 'types' => undef, 'callbacks' => undef, @@ -101,6 +103,7 @@ 'verbose_diag' => "diag_verbose", 'quote_null' => "escape_null", 'escape' => "escape_char", + 'comment' => "comment_str", ); my $last_new_err = Text::CSV_XS->SetDiag (0); my $ebcdic = ord ("A") == 0xC1; # Faster than $Config{'ebcdic'} @@ -268,8 +271,10 @@ '_is_bound' => 26, # 26 .. 29 'formula' => 38, 'strict' => 42, + 'skip_empty_rows' => 43, 'undef_str' => 46, - 'types' => 50, + 'comment_str' => 54, + 'types' => 62, ); # A `character' @@ -433,6 +438,12 @@ $self->{'strict'}; } # always_quote +sub skip_empty_rows { + my $self = shift; + @_ and $self->_set_attr_X ("skip_empty_rows", shift); + $self->{'skip_empty_rows'}; + } # always_quote + sub _SetDiagInfo { my ($self, $err, $msg) = @_; $self->SetDiag ($err); @@ -546,6 +557,16 @@ $self->{'undef_str'}; } # undef_str +sub comment_str { + my $self = shift; + if (@_) { + my $v = shift; + $self->{'comment_str'} = defined $v ? "$v" : undef; + $self->_cache_set ($_cache_id{'comment_str'}, $self->{'comment_str'}); + } + $self->{'comment_str'}; + } # comment_str + sub auto_diag { my $self = shift; if (@_) { @@ -1655,7 +1676,7 @@ =head1 SPECIFICATION -While no formal specification for CSV exists, L<RFC 4180|http://tools.ietf.org/html/rfc4180> +While no formal specification for CSV exists, L<RFC 4180|https://tools.ietf.org/html/rfc4180> (I<1>) describes the common format and establishes C<text/csv> as the MIME type registered with the IANA. L<RFC 7111|http://tools.ietf.org/html/rfc7111> (I<2>) adds fragments to CSV. @@ -1665,8 +1686,8 @@ (I<3>) provides an overview of the C<CSV> format in the most widely used applications and explains how it can best be used and supported. - 1) http://tools.ietf.org/html/rfc4180 - 2) http://tools.ietf.org/html/rfc7111 + 1) https://tools.ietf.org/html/rfc4180 + 2) https://tools.ietf.org/html/rfc7111 3) http://www.creativyst.com/Doc/Articles/CSV/CSV01.htm The basic rules are as follows: @@ -1901,6 +1922,19 @@ If this attribute is set to C<1>, any row that parses to a different number of fields than the previous row will cause the parser to throw error 2014. +=head3 skip_empty_rows +X<skip_empty_rows> + + my $csv = Text::CSV_XS->new ({ skip_empty_rows => 1 }); + $csv->skip_empty_rows (0); + my $f = $csv->skip_empty_rows; + +If this attribute is set to C<1>, any row that has an L</eol> immediately +following the start of line will be skipped. Default behavior is to return +one single empty field. + +This attribute is only used in parsing. + =head3 formula_handling =head3 formula @@ -2312,6 +2346,25 @@ This attribute has no meaning when parsing CSV data. +=head3 comment_str +X<comment_str> + + my $csv = Text::CSV_XS->new ({ comment_str => "#" }); + $csv->comment_str (undef); + my $s = $csv->comment_str; + +This attribute optionally defines a string to be recognized as comment. If +this attribute is defined, all lines starting with this sequence will not +be parsed as CSV but skipped as comment. + +This attribute has no meaning when generating CSV. + +Comment strings that start with any of the special characters/sequences are +not supported (so it cannot start with any of L</sep_char>, L</quote_char>, +L</escape_char>, L</sep>, L</quote>, or L</eol>). + +For convenience, C<comment> is an alias for C<comment_str>. + =head3 verbatim X<verbatim> @@ -2391,9 +2444,11 @@ quote_binary => 1, keep_meta_info => 0, strict => 0, + skip_empty_rows => 0, formula => 0, verbatim => 0, undef_str => undef, + comment_str => undef, types => undef, callbacks => undef, }); @@ -3347,7 +3402,7 @@ a reference to an C<ARRAY> or a C<HASH>, the output is appended to the data in the existing reference. The result of the parse should match what exists in the reference passed. This might come handy when you have to parse a set -of files with similar content (like data stored per period) and you want to +of files with similar content (like data stored per period) and you want to collect that into a single data structure: my %hash; @@ -4866,7 +4921,7 @@ =head1 COPYRIGHT AND LICENSE - Copyright (C) 2007-2020 H.Merijn Brand. All rights reserved. + Copyright (C) 2007-2021 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.45/CSV_XS.xs new/Text-CSV_XS-1.46/CSV_XS.xs --- old/Text-CSV_XS-1.45/CSV_XS.xs 2020-09-06 20:45:25.000000000 +0200 +++ new/Text-CSV_XS-1.46/CSV_XS.xs 2021-03-23 17:30:24.000000000 +0100 @@ -1,4 +1,4 @@ -/* Copyright (c) 2007-2020 H.Merijn Brand. All rights reserved. +/* Copyright (c) 2007-2021 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. @@ -155,8 +155,10 @@ #define CACHE_ID__has_hooks 36 #define CACHE_ID_formula 38 #define CACHE_ID_strict 42 +#define CACHE_ID_skip_empty_rows 43 #define CACHE_ID_undef_str 46 -#define CACHE_ID_types 50 +#define CACHE_ID_comment_str 54 +#define CACHE_ID_types 62 #define byte unsigned char #define ulng unsigned long @@ -193,10 +195,15 @@ byte quote_empty; byte formula; + byte utf8; + byte has_ahead; + byte eolx; byte strict; short strict_n; + byte skip_empty_rows; + long is_bound; ulng recno; @@ -215,11 +222,9 @@ char * bptr; SV * tmp; - byte utf8; - byte has_ahead; - byte eolx; byte undef_flg; byte * undef_str; + byte * comment_str; int eol_pos; STRLEN size; STRLEN used; @@ -479,6 +484,7 @@ case CACHE_ID_formula: csv->formula = bv; break; case CACHE_ID_strict: csv->strict = bv; break; case CACHE_ID_verbatim: csv->verbatim = bv; break; + case CACHE_ID_skip_empty_rows: csv->skip_empty_rows = bv; break; case CACHE_ID_auto_diag: csv->auto_diag = bv; break; case CACHE_ID_diag_verbose: csv->diag_verbose = bv; break; case CACHE_ID__has_ahead: csv->has_ahead = bv; break; @@ -517,6 +523,10 @@ } break; + case CACHE_ID_comment_str: + csv->comment_str = *cp ? (byte *)cp : NULL; + break; + case CACHE_ID_types: if (cp && len) { csv->types = cp; @@ -536,6 +546,7 @@ (void)memcpy (cache, csv, sizeof (csv_t)); } /* cache_set */ +#define _pretty_strl(csv) cx_pretty_str (aTHX_ csv, strlen (csv)) #define _pretty_str(csv,xse) cx_pretty_str (aTHX_ csv, xse) static char *cx_pretty_str (pTHX_ byte *s, STRLEN l) { SV *dsv = sv_2mortal (newSVpvs ("")); @@ -584,6 +595,7 @@ _cache_show_byte ("diag_verbose", csv->diag_verbose); _cache_show_byte ("formula", csv->formula); _cache_show_byte ("strict", csv->strict); + _cache_show_byte ("skip_empty_rows", csv->skip_empty_rows); _cache_show_byte ("has_error_input", csv->has_error_input); _cache_show_byte ("blank_is_undef", csv->blank_is_undef); _cache_show_byte ("empty_is_undef", csv->empty_is_undef); @@ -602,15 +614,15 @@ if (csv->quo_len > 1) _cache_show_str ("quote", csv->quo_len, csv->quo); if (csv->types_len) - _cache_show_str ("types", csv->types_len, csv->types); + _cache_show_str ("types", csv->types_len, (byte *)csv->types); else - _cache_show_str ("types", 0, ""); + _cache_show_str ("types", 0, (byte *)""); if (csv->bptr) - _cache_show_str ("bptr", (int)strlen (csv->bptr), csv->bptr); + _cache_show_str ("bptr", (int)strlen (csv->bptr), (byte *)csv->bptr); if (csv->tmp && SvPOK (csv->tmp)) { char *s = SvPV_nolen (csv->tmp); - _cache_show_str ("tmp", (int)strlen (s), s); + _cache_show_str ("tmp", (int)strlen (s), (byte *)s); } } /* xs_cache_diag */ @@ -699,6 +711,11 @@ else csv->undef_str = NULL; + if ((svp = hv_fetchs (self, "comment_str", FALSE)) && *svp && SvOK (*svp)) + csv->comment_str = (byte *)SvPV_nolen (*svp); + else + csv->comment_str = NULL; + if ((svp = hv_fetchs (self, "_types", FALSE)) && *svp && SvOK (*svp)) { csv->types = SvPV (*svp, len); csv->types_len = len; @@ -718,6 +735,7 @@ csv->decode_utf8 = bool_opt ("decode_utf8"); csv->always_quote = bool_opt ("always_quote"); csv->strict = bool_opt ("strict"); + csv->skip_empty_rows = bool_opt ("skip_empty_rows"); csv->quote_empty = bool_opt ("quote_empty"); csv->quote_space = bool_opt_def ("quote_space", 1); csv->escape_null = bool_opt_def ("escape_null", 1); @@ -1364,9 +1382,9 @@ #endif if (is_SEP (c)) { #if MAINT_DEBUG > 1 - (void)fprintf (stderr, "# %d/%d/%03x pos %d = SEP %s\t'%s'\n", + (void)fprintf (stderr, "# %d/%d/%03x pos %d = SEP %s\t%s\n", waitingForField ? 1 : 0, sv ? 1 : 0, f, spl, - _sep_string (csv), csv->bptr + csv->used); + _sep_string (csv), _pretty_strl (csv->bptr + csv->used)); #endif if (waitingForField) { /* ,1,"foo, 3",,bar, @@ -1399,9 +1417,9 @@ else if (is_QUOTE (c)) { #if MAINT_DEBUG > 1 - (void)fprintf (stderr, "# %d/%d/%03x pos %d = QUO '%c'\t\t'%s'\n", + (void)fprintf (stderr, "# %d/%d/%03x pos %d = QUO '%c'\t\t%s\n", waitingForField ? 1 : 0, sv ? 1 : 0, f, spl, c, - csv->bptr + csv->used); + _pretty_strl (csv->bptr + csv->used)); #endif if (waitingForField) { /* ,1,"foo, 3",,bar,\r\n @@ -1515,16 +1533,26 @@ return TRUE; } - if (csv->useIO && csv->eol_len == 0 && !is_csv_binary (c3)) { - /* ,1,"foo\n 3",,"bar"\r - * baz,4 - * ^ - */ - set_eol_is_cr (csv); - csv->used--; - csv->has_ahead++; - AV_PUSH; - return TRUE; + if (csv->useIO && csv->eol_len == 0) { + if (c3 == CH_CR) { /* \r followed by an empty line */ + /* ,1,"foo, 3"\r\r + * ^ + */ + set_eol_is_cr (csv); + goto EOLX; + } + + if (!is_csv_binary (c3)) { + /* ,1,"foo\n 3",,"bar"\r + * baz,4 + * ^ + */ + set_eol_is_cr (csv); + csv->used--; + csv->has_ahead++; + AV_PUSH; + return TRUE; + } } ParseError (csv, quoesc ? 2023 : 2010, csv->used - 2); @@ -1570,9 +1598,9 @@ else if (c == csv->escape_char && csv->escape_char) { #if MAINT_DEBUG > 1 - (void)fprintf (stderr, "# %d/%d/%03x pos %d = ESC '%c'\t'%s%\n", + (void)fprintf (stderr, "# %d/%d/%03x pos %d = ESC '%c'\t%s\n", waitingForField ? 1 : 0, sv ? 1 : 0, f, spl, c, - csv->bptr + csv->used); + _pretty_strl (csv->bptr + csv->used)); #endif /* This means quote_char != escape_char */ if (waitingForField) { @@ -1646,10 +1674,22 @@ if (c == CH_NL || is_EOL (c)) { EOLX: #if MAINT_DEBUG > 1 - (void)fprintf (stderr, "# %d/%d/%03x pos %d = NL\t'%s'\n", + (void)fprintf (stderr, "# %d/%d/%03x pos %d = NL\t%s\n", waitingForField ? 1 : 0, sv ? 1 : 0, f, spl, - csv->bptr + csv->used); + _pretty_strl (csv->bptr + csv->used)); #endif + if (fnum == 1 && f == 0 && SvCUR (sv) == 0 && csv->skip_empty_rows) { + csv->fld_idx = 0; + c = CSV_GET; + if (c == EOF) { + sv_free (sv); + sv = NULL; + waitingForField = 0; + break; + } + goto restart; + } + if (waitingForField) { /* ,1,"foo, 3",,bar, * ^ @@ -1721,14 +1761,12 @@ if (waitingForField) { int c2; - waitingForField = 0; - if (csv->eol_is_cr) { /* ,1,"foo\n 3",,bar,\r * ^ */ c = CH_NL; - goto restart; + goto EOLX; } c2 = CSV_GET; @@ -1753,19 +1791,42 @@ * ^ */ c = c2; - goto restart; + goto EOLX; } - if (csv->useIO && csv->eol_len == 0 && !is_csv_binary (c2)) { - /* ,1,"foo\n 3",,bar,\r - * baz,4 - * ^ - */ - set_eol_is_cr (csv); - csv->used--; - csv->has_ahead++; - AV_PUSH; - return TRUE; + if (csv->useIO && csv->eol_len == 0) { + if (c2 == CH_CR) { /* \r followed by an empty line */ + /* ,1,"foo\n 3",,bar,\r\r + * ^ + */ + set_eol_is_cr (csv); + goto EOLX; + } + + waitingForField = 0; + + if (!is_csv_binary (c2)) { + /* ,1,"foo\n 3",,bar,\r + * baz,4 + * ^ + */ + set_eol_is_cr (csv); + csv->used--; + csv->has_ahead++; + if (fnum == 1 && f == 0 && SvCUR (sv) == 0 && csv->skip_empty_rows) { + csv->fld_idx = 0; + c = CSV_GET; + if (c == EOF) { + sv_free (sv); + sv = NULL; + waitingForField = 0; + break; + } + goto restart; + } + AV_PUSH; + return TRUE; + } } /* ,1,"foo\n 3",,bar,\r\t @@ -1792,8 +1853,7 @@ /* ,1,"foo\n 3",,bar\r * ^ */ - AV_PUSH; - return TRUE; + goto EOLX; } c2 = CSV_GET; @@ -1802,20 +1862,36 @@ /* ,1,"foo\n 3",,bar\r\n * ^ */ - AV_PUSH; - return TRUE; + goto EOLX; } - if (csv->useIO && csv->eol_len == 0 && !is_csv_binary (c2)) { - /* ,1,"foo\n 3",,bar\r - * baz,4 - * ^ - */ - set_eol_is_cr (csv); - csv->used--; - csv->has_ahead++; - AV_PUSH; - return TRUE; + if (csv->useIO && csv->eol_len == 0) { + if (!is_csv_binary (c2) + /* ,1,"foo\n 3",,bar\r + * baz,4 + * ^ + */ + || c2 == CH_CR) { + /* ,1,"foo\n 3",,bar,\r\r + * ^ + */ + set_eol_is_cr (csv); + csv->used--; + csv->has_ahead++; + if (fnum == 1 && f == 0 && SvCUR (sv) == 0 && csv->skip_empty_rows) { + csv->fld_idx = 0; + c = CSV_GET; + if (c == EOF) { + sv_free (sv); + sv = NULL; + waitingForField = 0; + break; + } + goto restart; + } + AV_PUSH; + return TRUE; + } } /* ,1,"foo\n 3",,bar\r\t @@ -1826,9 +1902,9 @@ } /* CH_CR */ else { #if MAINT_DEBUG > 1 - (void)fprintf (stderr, "# %d/%d/%03x pos %d = CCC '%c'\t\t'%s'\n", + (void)fprintf (stderr, "# %d/%d/%03x pos %d = CCC '%c'\t\t%s\n", waitingForField ? 1 : 0, sv ? 1 : 0, f, spl, c, - csv->bptr + csv->used); + _pretty_strl (csv->bptr + csv->used)); #endif /* Needed for non-IO parse, where EOL is not set during read */ if (csv->eolx && c == CH_EOL && @@ -1843,6 +1919,28 @@ } if (waitingForField) { + if (csv->comment_str && !f && !spl && c == *csv->comment_str) { + STRLEN cl = strlen (csv->comment_str); + +#if MAINT_DEBUG > 5 + (void)fprintf (stderr, + "COMMENT? cl = %d, size = %d, used = %d\n", + cl, csv->size, csv->used); +#endif + if (cl == 1 || ( + (csv->size - csv->used >= cl - 1 && + !memcmp (csv->bptr + csv->used, csv->comment_str + 1, cl - 1) && + (csv->used += cl - 1)))) { + csv->used = csv->size; + csv->fld_idx = 0; + c = CSV_GET; +#if MAINT_DEBUG > 5 + (void)fprintf (stderr, "# COMMENT, SKIPPED\n"); +#endif + goto restart; + } + } + if (csv->allow_whitespace && is_whitespace (c)) { do { c = CSV_GET; @@ -1874,6 +1972,8 @@ } else { if (is_csv_binary (c)) { + if (csv->useIO && c == EOF) + break; f |= CSV_FLAGS_BIN; unless (csv->binary || csv->utf8) ERROR_INSIDE_FIELD (2037); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Text-CSV_XS-1.45/ChangeLog new/Text-CSV_XS-1.46/ChangeLog --- old/Text-CSV_XS-1.45/ChangeLog 2020-12-24 15:40:05.000000000 +0100 +++ new/Text-CSV_XS-1.46/ChangeLog 2021-03-24 12:53:31.000000000 +0100 @@ -1,3 +1,11 @@ +1.46 - 2021-03-24, H.Merijn Brand + * It's 2021 + * New attribute comment_str (RFC 4180-bis) + * New attribute skip_empty_rows (RFC 4180-bis) + * http -> https in links in docs + * Fix several issues with auto-detecting \r as EOL + * Tested on perl-5.6.1 .. perl-5.32.1 and perl-5.33.8 (145) + 1.45 - 2020-12-24, H.Merijn Brand * Update to Devel::PPPort-3.60 (3.59 was b0rked) * Allow adding to existing data in csv (out => $ref) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Text-CSV_XS-1.45/MANIFEST new/Text-CSV_XS-1.46/MANIFEST --- old/Text-CSV_XS-1.45/MANIFEST 2020-12-24 17:50:41.000000000 +0100 +++ new/Text-CSV_XS-1.46/MANIFEST 2021-03-24 14:54:52.000000000 +0100 @@ -18,6 +18,7 @@ t/41_null.t NULL test in combination with line endings t/45_eol.t Embedded EOL t/46_eol_si.t Embedded EOL using scalar io (perlio) +t/47_comment.t Comment skipping t/50_utf8.t Unicode stress tests t/51_utf8.t Unicode IO encoding tests t/55_combi.t Different CSV character combinations diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Text-CSV_XS-1.45/META.json new/Text-CSV_XS-1.46/META.json --- old/Text-CSV_XS-1.45/META.json 2020-12-24 17:50:41.000000000 +0100 +++ new/Text-CSV_XS-1.46/META.json 2021-03-24 14:54:52.000000000 +0100 @@ -1,67 +1,67 @@ { + "generated_by" : "Author", + "provides" : { + "Text::CSV_XS" : { + "file" : "CSV_XS.pm", + "version" : "1.46" + } + }, + "name" : "Text-CSV_XS", + "version" : "1.46", "author" : [ "H.Merijn Brand <h.m.br...@xs4all.nl>" ], - "abstract" : "Comma-Separated Values manipulation routines", - "license" : [ - "perl_5" - ], - "generated_by" : "Author", + "resources" : { + "homepage" : "https://metacpan.org/pod/Text::CSV_XS", + "repository" : { + "type" : "git", + "url" : "https://github.com/Tux/Text-CSV_XS", + "web" : "https://github.com/Tux/Text-CSV_XS" + }, + "x_IRC" : "irc://irc.perl.org/#csv", + "bugtracker" : { + "web" : "http://rt.cpan.org/NoAuth/Bugs.html?Dist=Text-CSV_XS" + }, + "license" : [ + "http://dev.perl.org/licenses/" + ] + }, "prereqs" : { - "configure" : { + "build" : { "requires" : { - "ExtUtils::MakeMaker" : "0" + "Config" : "0" } }, - "build" : { + "runtime" : { "requires" : { - "Config" : "0" + "XSLoader" : "0", + "perl" : "5.006001", + "IO::Handle" : "0" + }, + "recommends" : { + "Encode" : "3.08" } }, - "test" : { + "configure" : { "requires" : { - "Tie::Scalar" : "0", - "Test::More" : "0" + "ExtUtils::MakeMaker" : "0" } }, - "runtime" : { - "recommends" : { - "Encode" : "3.08" - }, + "test" : { "requires" : { - "IO::Handle" : "0", - "XSLoader" : "0", - "perl" : "5.006001" + "Tie::Scalar" : "0", + "Test::More" : "0" } } }, - "name" : "Text-CSV_XS", - "dynamic_config" : 1, - "version" : "1.45", + "abstract" : "Comma-Separated Values manipulation routines", "meta-spec" : { "version" : 2, "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec" }, "release_status" : "stable", - "provides" : { - "Text::CSV_XS" : { - "version" : "1.45", - "file" : "CSV_XS.pm" - } - }, - "resources" : { - "repository" : { - "web" : "https://github.com/Tux/Text-CSV_XS", - "url" : "https://github.com/Tux/Text-CSV_XS", - "type" : "git" - }, - "license" : [ - "http://dev.perl.org/licenses/" - ], - "bugtracker" : { - "web" : "http://rt.cpan.org/NoAuth/Bugs.html?Dist=Text-CSV_XS" - }, - "homepage" : "https://metacpan.org/pod/Text::CSV_XS", - "x_IRC" : "irc://irc.perl.org/#csv" - } + "license" : [ + "perl_5" + ], + "dynamic_config" : 1 } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Text-CSV_XS-1.45/META.yml new/Text-CSV_XS-1.46/META.yml --- old/Text-CSV_XS-1.45/META.yml 2020-12-24 17:50:41.000000000 +0100 +++ new/Text-CSV_XS-1.46/META.yml 2021-03-24 14:54:52.000000000 +0100 @@ -16,7 +16,7 @@ provides: Text::CSV_XS: file: CSV_XS.pm - version: '1.45' + version: '1.46' recommends: Encode: '3.08' requires: @@ -31,4 +31,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.45' +version: '1.46' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Text-CSV_XS-1.45/Makefile.PL new/Text-CSV_XS-1.46/Makefile.PL --- old/Text-CSV_XS-1.45/Makefile.PL 2020-07-23 13:12:29.000000000 +0200 +++ new/Text-CSV_XS-1.46/Makefile.PL 2021-02-10 11:31:04.000000000 +0100 @@ -1,6 +1,6 @@ #!/usr/bin/perl -# Copyright PROCURA B.V. (c) 2006-2020 H.Merijn Brand +# Copyright PROCURA B.V. (c) 2006-2021 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.45/README new/Text-CSV_XS-1.46/README --- old/Text-CSV_XS-1.45/README 2020-07-23 13:12:29.000000000 +0200 +++ new/Text-CSV_XS-1.46/README 2021-02-10 11:31:04.000000000 +0100 @@ -7,7 +7,7 @@ combine fields into a CSV string and parse a CSV string into fields. Copying: - Copyright (c) 2007-2020 H.Merijn Brand. All rights reserved. + Copyright (c) 2007-2021 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.45/examples/csv-check new/Text-CSV_XS-1.46/examples/csv-check --- old/Text-CSV_XS-1.45/examples/csv-check 2020-07-23 13:12:29.000000000 +0200 +++ new/Text-CSV_XS-1.46/examples/csv-check 2021-02-10 11:31:04.000000000 +0100 @@ -1,7 +1,7 @@ #!/pro/bin/perl # csv-check: Check validity of CSV file and report -# (m)'20 [21 May 2020] Copyright H.M.Brand 2007-2020 +# (m)'20 [21 May 2020] Copyright H.M.Brand 2007-2021 # This code requires the defined-or feature and PerlIO diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Text-CSV_XS-1.45/examples/csv2xls new/Text-CSV_XS-1.46/examples/csv2xls --- old/Text-CSV_XS-1.45/examples/csv2xls 2020-07-23 13:12:29.000000000 +0200 +++ new/Text-CSV_XS-1.46/examples/csv2xls 2021-02-10 11:31:04.000000000 +0100 @@ -1,7 +1,7 @@ #!/pro/bin/perl # csv2xls: Convert csv to xls -# (m)'20 [25 Mar 2020] Copyright H.M.Brand 2007-2020 +# (m)'20 [25 Mar 2020] Copyright H.M.Brand 2007-2021 use 5.12.0; use warnings; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Text-CSV_XS-1.45/examples/csv2xlsx new/Text-CSV_XS-1.46/examples/csv2xlsx --- old/Text-CSV_XS-1.45/examples/csv2xlsx 2020-11-30 12:58:18.000000000 +0100 +++ new/Text-CSV_XS-1.46/examples/csv2xlsx 2021-02-10 11:31:04.000000000 +0100 @@ -1,7 +1,7 @@ #!/pro/bin/perl # csv2xlsx: Convert csv to xlsx -# (m)'20 [30 Nov 2020] Copyright H.M.Brand 2007-2020 +# (m)'20 [30 Nov 2020] Copyright H.M.Brand 2007-2021 use 5.14.0; use warnings; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Text-CSV_XS-1.45/examples/csvdiff new/Text-CSV_XS-1.46/examples/csvdiff --- old/Text-CSV_XS-1.45/examples/csvdiff 2020-07-23 13:12:29.000000000 +0200 +++ new/Text-CSV_XS-1.46/examples/csvdiff 2021-02-10 11:31:04.000000000 +0100 @@ -4,7 +4,7 @@ use warnings; # csvdiff: Show differences between CSV files -# (m)'19 [05 Mar 2019] Copyright H.M.Brand 2009-2020 +# (m)'19 [05 Mar 2019] Copyright H.M.Brand 2009-2021 our $VERSION = "1.02 - 20190305"; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Text-CSV_XS-1.45/examples/parser-xs.pl new/Text-CSV_XS-1.46/examples/parser-xs.pl --- old/Text-CSV_XS-1.45/examples/parser-xs.pl 2020-07-23 13:12:29.000000000 +0200 +++ new/Text-CSV_XS-1.46/examples/parser-xs.pl 2021-02-10 11:31:04.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-2020 +# (m)'08 [23 Apr 2008] Copyright H.M.Brand 2008-2021 use strict; use warnings; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Text-CSV_XS-1.45/examples/rewrite.pl new/Text-CSV_XS-1.46/examples/rewrite.pl --- old/Text-CSV_XS-1.45/examples/rewrite.pl 2020-07-23 13:12:29.000000000 +0200 +++ new/Text-CSV_XS-1.46/examples/rewrite.pl 2021-02-10 11:31:04.000000000 +0100 @@ -4,7 +4,7 @@ use warnings; # rewrite.pl: Convert csv to csv -# (m)'17 [20 Sep 2017] Copyright H.M.Brand 2014-2020 +# (m)'17 [20 Sep 2017] Copyright H.M.Brand 2014-2021 our $VERSION = "0.05 - 20170920"; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Text-CSV_XS-1.45/examples/speed.pl new/Text-CSV_XS-1.46/examples/speed.pl --- old/Text-CSV_XS-1.45/examples/speed.pl 2020-07-23 13:12:29.000000000 +0200 +++ new/Text-CSV_XS-1.46/examples/speed.pl 2021-02-10 11:31:04.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-2020 +# (m)'08 [07 Apr 2008] Copyright H.M.Brand 2007-2021 require 5.006001; use strict; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Text-CSV_XS-1.45/ppport.h new/Text-CSV_XS-1.46/ppport.h --- old/Text-CSV_XS-1.45/ppport.h 2020-10-17 12:00:37.000000000 +0200 +++ new/Text-CSV_XS-1.46/ppport.h 2021-03-21 09:55:10.000000000 +0100 @@ -6,7 +6,7 @@ ppport.h -- Perl/Pollution/Portability Version 3.62 - Automatically created by Devel::PPPort running under perl 5.032000. + Automatically created by Devel::PPPort running under perl 5.032001. Do NOT edit this file directly! -- Edit PPPort_pm.PL and the includes in parts/inc/ instead. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Text-CSV_XS-1.45/t/12_acc.t new/Text-CSV_XS-1.46/t/12_acc.t --- old/Text-CSV_XS-1.45/t/12_acc.t 2020-07-23 13:12:30.000000000 +0200 +++ new/Text-CSV_XS-1.46/t/12_acc.t 2021-03-22 13:19:50.000000000 +0100 @@ -3,7 +3,7 @@ use strict; use warnings; -use Test::More tests => 238; +use Test::More tests => 243; BEGIN { use_ok "Text::CSV_XS"; @@ -33,6 +33,7 @@ is ($csv->verbatim, 0, "verbatim"); is ($csv->formula, "none", "formula"); is ($csv->strict, 0, "strict"); +is ($csv->skip_empty_rows, 0, "skip_empty_rows"); is ($csv->quote_space, 1, "quote_space"); is ($csv->quote_empty, 0, "quote_empty"); is ($csv->escape_null, 1, "escape_null"); @@ -41,6 +42,7 @@ is ($csv->record_number, 0, "record_number"); is ($csv->decode_utf8, 1, "decode_utf8"); is ($csv->undef_str, undef, "undef_str"); +is ($csv->comment_str, undef, "comment_str"); is ($csv->binary (1), 1, "binary (1)"); my @fld = ( 'txt =, "Hi!"', "Yes", "", 2, undef, "1.09", "\r", undef ); @@ -93,6 +95,7 @@ is ($csv->verbatim (1), 1, "verbatim (1)"); is ($csv->formula ("diag"), "diag", "formula (\"diag\")"); is ($csv->strict (1), 1, "strict (1)"); +is ($csv->skip_empty_rows (1), 1, "skip_empty_rows (1)"); is ($csv->quote_space (1), 1, "quote_space (1)"); is ($csv->quote_empty (1), 1, "quote_empty (1)"); is ($csv->escape_null (1), 1, "escape_null (1)"); @@ -105,6 +108,7 @@ is ($csv->string, qq{=txt \\=, "Hi!"=;=Yes=;==;=2=;;=1.09=;=\r=;\r}, "string"); is ($csv->undef_str ("-"), "-", "undef_str"); +is ($csv->comment_str ("#"), "#", "comment_str"); is ($csv->allow_whitespace (0), 0, "allow_whitespace (0)"); is ($csv->quote_space (0), 0, "quote_space (0)"); @@ -118,6 +122,7 @@ is ($csv->quote ("++"), "++", "quote (\"++\")"); is ($csv->quote_char (), "\0", "quote_char"); is ($csv->undef_str (undef), undef, "undef_str"); +is ($csv->comment_str (undef), undef, "comment_str"); # Test single-byte specials in UTF-8 mode is ($csv->sep ("|"), "|", "sep |"); @@ -254,8 +259,8 @@ always_quote quote_space quote_empty quote_binary escape_null keep_meta_info - verbatim strict formula - undef_str + verbatim strict skip_empty_rows formula + undef_str comment_str types callbacks ENCODING diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Text-CSV_XS-1.45/t/20_file.t new/Text-CSV_XS-1.46/t/20_file.t --- old/Text-CSV_XS-1.45/t/20_file.t 2017-03-02 13:28:39.000000000 +0100 +++ new/Text-CSV_XS-1.46/t/20_file.t 2021-03-23 16:05:24.000000000 +0100 @@ -3,7 +3,7 @@ use strict; use warnings; -use Test::More tests => 105; +use Test::More tests => 109; BEGIN { use_ok "Text::CSV_XS"; @@ -108,7 +108,6 @@ is ($csv->eof, 1, "EOF"); # Edge cases -$csv = Text::CSV_XS->new ({ escape_char => "+" }); for ([ 1, 1, 0, "\n" ], [ 2, 1, 0, "+\n" ], [ 3, 1, 0, "+" ], @@ -118,33 +117,35 @@ [ 7, 0, 2027, qq{"+"} ], [ 8, 0, 2024, qq{"+} ], [ 9, 0, 2011, qq{""+} ], - [ 10, 0, 2037, "\r" ], - [ 11, 0, 2031, "\r\r" ], - [ 12, 0, 2032, "+\r\r" ], - [ 13, 0, 2032, "+\r\r+" ], + [ 10, 1, 0, "\r" ], + [ 11, 0, 2031, "\r\b" ], + [ 12, 0, 2032, "+\r\b" ], + [ 13, 0, 2032, "+\r\b+" ], [ 14, 0, 2022, qq{"\r"} ], - [ 15, 0, 2022, qq{"\r\r" } ], - [ 16, 0, 2022, qq{"\r\r"\t} ], - [ 17, 0, 2025, qq{"+\r\r"} ], - [ 18, 0, 2025, qq{"+\r\r+"} ], - [ 19, 0, 2022, qq{"\r"\r} ], - [ 20, 0, 2022, qq{"\r\r"\r} ], - [ 21, 0, 2025, qq{"+\r\r"\r} ], - [ 22, 0, 2025, qq{"+\r\r+"\r} ], + [ 15, 0, 2022, qq{"\r\b" } ], + [ 16, 0, 2022, qq{"\r\b"\t} ], + [ 17, 0, 2025, qq{"+\r\b"} ], + [ 18, 0, 2025, qq{"+\r\b+"} ], + [ 19, 0, 2022, qq{"\r"\b} ], + [ 20, 0, 2022, qq{"\r\b"\b} ], + [ 21, 0, 2025, qq{"+\r\b"\b} ], + [ 22, 0, 2025, qq{"+\r\b+"\b} ], + [ 23, 0, 2037, qq{\b} ], + [ 24, 0, 2026, qq{"\b"} ], ) { my ($tst, $valid, $err, $str) = @$_; my $raw = $] < 5.008 ? "" : ":raw"; open FH, ">$raw", $tfn or die "$tfn: $!"; print FH $str; close FH; + + $csv = Text::CSV_XS->new ({ escape_char => "+" }); open FH, "<$raw", $tfn or die "$tfn: $!"; my $row = $csv->getline (*FH); close FH; my @err = $csv->error_diag; my $sstr = _readable ($str); SKIP: { - $tst == 10 && $] >= 5.008 && $] < 5.008003 && $UTF8 and - skip "Be reasonable, this perl version does not do Unicode reliable", 2; ok ($valid ? $row : !$row, "$tst - getline ESC +, '$sstr'"); is ($err[0], $err, "Error expected $err"); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Text-CSV_XS-1.45/t/21_lexicalio.t new/Text-CSV_XS-1.46/t/21_lexicalio.t --- old/Text-CSV_XS-1.45/t/21_lexicalio.t 2017-03-02 13:28:39.000000000 +0100 +++ new/Text-CSV_XS-1.46/t/21_lexicalio.t 2021-03-23 16:05:09.000000000 +0100 @@ -3,7 +3,7 @@ use strict; use warnings; -use Test::More tests => 105; +use Test::More tests => 109; BEGIN { use_ok "Text::CSV_XS"; @@ -108,7 +108,6 @@ is ($csv->eof, 1, "EOF"); # Edge cases -$csv = Text::CSV_XS->new ({ escape_char => "+" }); for ([ 1, 1, 0, "\n" ], [ 2, 1, 0, "+\n" ], [ 3, 1, 0, "+" ], @@ -118,25 +117,29 @@ [ 7, 0, 2027, qq{"+"} ], [ 8, 0, 2024, qq{"+} ], [ 9, 0, 2011, qq{""+} ], - [ 10, 0, 2037, "\r" ], - [ 11, 0, 2031, "\r\r" ], - [ 12, 0, 2032, "+\r\r" ], - [ 13, 0, 2032, "+\r\r+" ], + [ 10, 1, 0, "\r" ], + [ 11, 0, 2031, "\r\b" ], + [ 12, 0, 2032, "+\r\b" ], + [ 13, 0, 2032, "+\r\b+" ], [ 14, 0, 2022, qq{"\r"} ], - [ 15, 0, 2022, qq{"\r\r" } ], - [ 16, 0, 2022, qq{"\r\r"\t} ], - [ 17, 0, 2025, qq{"+\r\r"} ], - [ 18, 0, 2025, qq{"+\r\r+"} ], - [ 19, 0, 2022, qq{"\r"\r} ], - [ 20, 0, 2022, qq{"\r\r"\r} ], - [ 21, 0, 2025, qq{"+\r\r"\r} ], - [ 22, 0, 2025, qq{"+\r\r+"\r} ], + [ 15, 0, 2022, qq{"\r\b" } ], + [ 16, 0, 2022, qq{"\r\b"\t} ], + [ 17, 0, 2025, qq{"+\r\b"} ], + [ 18, 0, 2025, qq{"+\r\b+"} ], + [ 19, 0, 2022, qq{"\r"\b} ], + [ 20, 0, 2022, qq{"\r\b"\b} ], + [ 21, 0, 2025, qq{"+\r\b"\b} ], + [ 22, 0, 2025, qq{"+\r\b+"\b} ], + [ 23, 0, 2037, qq{\b} ], + [ 24, 0, 2026, qq{"\b"} ], ) { my ($tst, $valid, $err, $str) = @$_; my $raw = $] < 5.008 ? "" : ":raw"; open my $io, ">$raw", $tfn or die "$tfn: $!"; print $io $str; close $io; + + $csv = Text::CSV_XS->new ({ escape_char => "+" }); open $io, "<$raw", $tfn or die "$tfn: $!"; my $row = $csv->getline ($io); close $io; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Text-CSV_XS-1.45/t/22_scalario.t new/Text-CSV_XS-1.46/t/22_scalario.t --- old/Text-CSV_XS-1.45/t/22_scalario.t 2017-03-02 13:28:39.000000000 +0100 +++ new/Text-CSV_XS-1.46/t/22_scalario.t 2021-03-23 16:06:32.000000000 +0100 @@ -15,7 +15,7 @@ plan skip_all => "No reliable perlIO available"; } else { - plan tests => 132; + plan tests => 136; } } @@ -134,7 +134,6 @@ } # Edge cases -$csv = Text::CSV_XS->new ({ escape_char => "+" }); for ([ 1, 1, 0, "\n" ], [ 2, 1, 0, "+\n" ], [ 3, 1, 0, "+" ], @@ -144,21 +143,24 @@ [ 7, 0, 2027, qq{"+"} ], [ 8, 0, 2024, qq{"+} ], [ 9, 0, 2011, qq{""+} ], - [ 10, 0, 2037, "\r" ], - [ 11, 0, 2031, "\r\r" ], - [ 12, 0, 2032, "+\r\r" ], - [ 13, 0, 2032, "+\r\r+" ], + [ 10, 1, 0, "\r" ], + [ 11, 0, 2031, "\r\b" ], + [ 12, 0, 2032, "+\r\b" ], + [ 13, 0, 2032, "+\r\b+" ], [ 14, 0, 2022, qq{"\r"} ], - [ 15, 0, 2022, qq{"\r\r" } ], - [ 16, 0, 2022, qq{"\r\r"\t} ], - [ 17, 0, 2025, qq{"+\r\r"} ], - [ 18, 0, 2025, qq{"+\r\r+"} ], - [ 19, 0, 2022, qq{"\r"\r} ], - [ 20, 0, 2022, qq{"\r\r"\r} ], - [ 21, 0, 2025, qq{"+\r\r"\r} ], - [ 22, 0, 2025, qq{"+\r\r+"\r} ], + [ 15, 0, 2022, qq{"\r\b" } ], + [ 16, 0, 2022, qq{"\r\b"\t} ], + [ 17, 0, 2025, qq{"+\r\b"} ], + [ 18, 0, 2025, qq{"+\r\b+"} ], + [ 19, 0, 2022, qq{"\r"\b} ], + [ 20, 0, 2022, qq{"\r\b"\b} ], + [ 21, 0, 2025, qq{"+\r\b"\b} ], + [ 22, 0, 2025, qq{"+\r\b+"\b} ], + [ 23, 0, 2037, qq{\b} ], + [ 24, 0, 2026, qq{"\b"} ], ) { my ($tst, $valid, $err, $str) = @$_; + $csv = Text::CSV_XS->new ({ escape_char => "+" }); $io_str = $str; open $io, "<", \$io_str or die "IO: $!"; binmode $io; my $row = $csv->getline ($io); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Text-CSV_XS-1.45/t/45_eol.t new/Text-CSV_XS-1.46/t/45_eol.t --- old/Text-CSV_XS-1.45/t/45_eol.t 2017-03-02 13:28:39.000000000 +0100 +++ new/Text-CSV_XS-1.46/t/45_eol.t 2021-03-23 17:43:28.000000000 +0100 @@ -3,7 +3,7 @@ use strict; use warnings; -use Test::More tests => 1082; +use Test::More tests => 1094; BEGIN { require_ok "Text::CSV_XS"; @@ -283,4 +283,42 @@ is_deeply ([$csv->fields], [qw( a b c )], "result"); } +foreach my $eol ("\n", "\r\n", "\r") { + my $s_eol = $eol; + $s_eol =~ s{\r}{\\r}; + $s_eol =~ s{\n}{\\n}; + foreach my $before ("1,2$eol", "") { + open my $fh, ">", $tfn or die "$tfn: $!\n"; + print $fh $before; # To test if skipping the very first line works + print $fh $eol; # skipped + print $fh qq{ $eol}; # -> [ " " ] + print $fh qq{,$eol}; # -> [ "", "" ] + print $fh $eol; # skipped + print $fh qq{""$eol}; # -> [ "" ] + print $fh qq{eol$eol};# -> [ "eol" ] + close $fh; + + my @expect = ([ " " ], [ "", "" ], [ "" ], [ "eol" ]); + $before and unshift @expect => [ 1, 2 ]; + + open $fh, "<", $tfn or die "$tfn: $!\n"; + my $csv = Text::CSV_XS->new ({ skip_empty_rows => 1, eol => $eol }); + my @csv; + while (my $row = $csv->getline ($fh)) { + push @csv => $row; + } + close $fh; + is_deeply (\@csv, \@expect, "Empty lines skipped $s_eol\tEOL set"); + + open $fh, "<", $tfn or die "$tfn: $!\n"; + $csv = Text::CSV_XS->new ({ skip_empty_rows => 1 }); + @csv = (); + while (my $row = $csv->getline ($fh)) { + push @csv => $row; + } + close $fh; + is_deeply (\@csv, \@expect, "Empty lines skipped $s_eol\tauto-detect"); + } + } + 1; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Text-CSV_XS-1.45/t/47_comment.t new/Text-CSV_XS-1.46/t/47_comment.t --- old/Text-CSV_XS-1.45/t/47_comment.t 1970-01-01 01:00:00.000000000 +0100 +++ new/Text-CSV_XS-1.46/t/47_comment.t 2021-03-20 18:04:28.000000000 +0100 @@ -0,0 +1,59 @@ +#!/usr/bin/perl + +use strict; +use warnings; + +use Test::More; +use Text::CSV_XS; + +BEGIN { + if ($] < 5.008002) { + plan skip_all => "These tests require Encode and Unicode support"; + } + else { + require Encode; + plan tests => 60; + } + require "./t/util.pl"; + } + +$| = 1; + +my $tfn = "_47cmnt.csv"; END { -f $tfn and unlink $tfn; } + +foreach my $cstr ("#", "//", "Comment", "\xe2\x98\x83") { + foreach my $rest ("", " 1,2", "a,b") { + + my $csv = Text::CSV_XS->new ({ binary => 1 }); + $csv->comment_str ($cstr); + + my $fh; + open $fh, ">", $tfn or die "$tfn: $!\n"; + print $fh qq{$cstr$rest\n}; + print $fh qq{c,$cstr\n}; + print $fh qq{ $cstr\n}; + print $fh qq{e,$cstr,$rest\n}; + print $fh qq{$cstr\n}; + print $fh qq{g,i$cstr\n}; + print $fh qq{j,"k\n${cstr}k"\n}; + print $fh qq{$cstr\n}; + close $fh; + + open $fh, "<", $tfn or die "$tfn: $!\n"; + + my $cuni = Encode::decode ("utf-8", $cstr); + my @rest = split m/,/ => $rest, -1; @rest or push @rest => ""; + + is_deeply ($csv->getline ($fh), [ "c", $cuni ], "$cstr , $rest"); + is_deeply ($csv->getline ($fh), [ " $cuni" ], "leading space"); + is_deeply ($csv->getline ($fh), [ "e", $cuni, @rest ], "not start of line"); + is_deeply ($csv->getline ($fh), [ "g", "i$cuni" ], "not start of field"); + is_deeply ($csv->getline ($fh), [ "j", "k\n${cuni}k" ], "in quoted field after NL"); + + close $fh; + + unlink $tfn; + } + } + +1; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Text-CSV_XS-1.45/t/80_diag.t new/Text-CSV_XS-1.46/t/80_diag.t --- old/Text-CSV_XS-1.45/t/80_diag.t 2020-07-23 13:12:32.000000000 +0200 +++ new/Text-CSV_XS-1.46/t/80_diag.t 2021-03-22 13:20:10.000000000 +0100 @@ -3,7 +3,7 @@ use strict; use warnings; - use Test::More tests => 334; + use Test::More tests => 335; #use Test::More "no_plan"; my %err;