Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

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

Report information
The Basics
Id: 76759
Status: resolved
Priority: 0/
Queue: Text-CSV-Slurp

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

Bug Information
Severity: Wishlist
Broken in: 0.9
Fixed in: (no value)



Subject: Add ability to disable output of header row
Hi, This module is great, and really helpful. You saved my having to write it myself. I have a feature request (with patch). It would be great if I could disable writing of the header row on calls to create(). I've attached a patch that adds a "include_header" boolean parameter. Thanks, Darian
Subject: include_header_Slurp.diff
--- lib/Text/CSV/Slurp.pm.orig 2012-04-12 18:11:28.398122939 -0400 +++ lib/Text/CSV/Slurp.pm 2012-04-12 18:27:32.757976198 -0400 @@ -77,15 +77,25 @@ delete $arg{field_order}; + my $include_header = exists $arg{include_header} + ? $arg{include_header} + : 1; + + delete $arg{include_header}; + %arg = ( binary => 1, %arg ); my $csv = Text::CSV->new( \%arg ); - unless ( $csv->combine( @names ) ) { - die "Failed to create the header row because of this invalid input: " . $csv->error_input; + if ( $include_header ) { + unless ( $csv->combine( @names ) ) { + die "Failed to create the header row because of this invalid input: " . $csv->error_input; + } } - my @string = $csv->string; + my @string = $include_header + ? $csv->string + : ''; for my $row ( @$list ) { my @data;
Thanks for taking the time to write this and apologies for the delay in replying. I don't want to introduce a new feature that changes existing behaviour unnecessarily. Otherwise, people using this module will be expecting headers and their code will break. If you could rewrite this to make the new behaviour optional not default, that would be great. If you could add tests and use github, even better ;)
No reply to request for updated patch. Closing