Tux / Text-CSV_XS

perl5 module for composition and decomposition of comma-separated values
17 stars 20 forks source link

skip empty or blank #9

Closed LadyAleena closed 7 years ago

LadyAleena commented 7 years ago

If a field is empty or blank, it would be nice if if could be skipped completely not made undef. So how about skip_empty and skip_blank?

(I was going to try to see if I could write this based on blank_is_undef and empty_is_undef, but I could not figure out how those interact with the method or function.)

Tux commented 7 years ago

• That would completely break if using hashes (using headers)

  a,b,c,d
  1,2,3,4
  6,,7,8

In the second row, $->{c} would be 8 and $->{d} would be undef or - with bind_columns - 4

• easy to do on lists

  my $aoa = csv (in => $file, on_in => sub { @{$_[1]} = grep { length } @{$_[1]} });

I understand your quest, but I think that an option like that would cause more obfuscation that it would address

Tux commented 7 years ago

As no counterargument has been posted, closing this discussion/issue