This queue is for tickets about the Text-CSV_XS CPAN distribution.

Report information
The Basics
Id:
113302
Status:
resolved
Priority:
Low/Low
Queue:

People
Owner:
Nobody in particular
Requestors:
NEILB [...] cpan.org
Cc:
AdminCc:

BugTracker
Severity:
Wishlist
Broken in:
(no value)
Fixed in:
1.23



Subject: Option to skip blank lines
I use the csv() function a lot, and recently have wished there was an option to specify that blank lines are skipped csv(skip => 'blank', in => $fh, ...); There are two main cases that I'd like to skip: 1. blank lines. Ie no sep_char seen, and nothing other than whitespace perhaps 2. effectively empty lines: the only character seen is sep_char Cheers, Neil
Subject: Re: [rt.cpan.org #113302] Option to skip blank lines
Date: Thu, 24 Mar 2016 12:44:38 +0100
To: bug-Text-CSV_XS@rt.cpan.org
From: "H.Merijn Brand" <h.m.brand@xs4all.nl>
On Thu, 24 Mar 2016 05:32:37 -0400, "Neil_Bowers via RT" <bug-Text-CSV_XS@rt.cpan.org> wrote:
Show quoted text
> I use the csv () function a lot, and recently have wished there was an option to specify that blank lines are skipped > > csv (skip => 'blank', in => $fh, ...); > > There are two main cases that I'd like to skip:
Use filter => $ cat test.csv 1,2,,3,4 a,b,c,, , d,e,,,t ,, f,g,h,i,j $ perl -MCSV -wE'csv (in => "test.csv")' 1,2,,3,4 a,b,c,, , d,e,,,t ,, f,g,h,i,j
Show quoted text
> 1. blank lines. Ie no sep_char seen, and nothing other than whitespace perhaps
$ perl -MCSV -wE'csv (in => "test.csv", filter => { 0 => sub { "@{$_[1]}" ne "" }})' 1,2,,3,4 a,b,c,, , d,e,,,t ,, f,g,h,i,j
Show quoted text
> 2. effectively empty lines: the only character seen is sep_char
$ perl -MCSV -wE'csv (in => "test.csv", filter => { 0 => sub { grep /\S/, @{$_[1]} }})' 1,2,,3,4 a,b,c,, d,e,,,t f,g,h,i,j Is that enough rope to tie the required knots? -- H.Merijn Brand http://tux.nl Perl Monger http://amsterdam.pm.org/ using perl5.00307 .. 5.23 porting perl5 on HP-UX, AIX, and openSUSE http://mirrors.develooper.com/hpux/ http://www.test-smoke.org/ http://qa.perl.org http://www.goldmark.org/jeff/stupid-disclaimers/

Message body not shown because it is not plain text.



This service runs on Request Tracker, is sponsored by The Perl Foundation, and maintained by Best Practical Solutions.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.