[libcatmandu-perl] 36/101: Move header option to TabularExporter
Jonas Smedegaard
dr at jones.dk
Tue Feb 23 13:43:51 UTC 2016
This is an automated email from the git hooks/post-receive script.
js pushed a commit to branch master
in repository libcatmandu-perl.
commit 7bdae41b260f7de4c01a190f36c8e13fe6e04b1e
Author: Jakob Voss <voss at gbv.de>
Date: Thu Dec 17 19:45:07 2015 +0100
Move header option to TabularExporter
---
lib/Catmandu/Exporter/CSV.pm | 5 +----
lib/Catmandu/TabularExporter.pm | 17 +++++++++++++----
2 files changed, 14 insertions(+), 8 deletions(-)
diff --git a/lib/Catmandu/Exporter/CSV.pm b/lib/Catmandu/Exporter/CSV.pm
index ac67698..9993ae6 100644
--- a/lib/Catmandu/Exporter/CSV.pm
+++ b/lib/Catmandu/Exporter/CSV.pm
@@ -15,7 +15,6 @@ has sep_char => (is => 'ro', default => sub { ',' });
has quote_char => (is => 'ro', default => sub { '"' });
has escape_char => (is => 'ro', default => sub { '"' });
has always_quote => (is => 'ro');
-has header => (is => 'ro', default => sub { 1 });
sub _build_csv {
my ($self) = @_;
@@ -136,9 +135,7 @@ See L<Catmandu::TabularExporter>.
=item header
-Includes a header line with the column names, if set to C<1> (the default).
-See L<Catmandu::TabularExporter> on how to configure the field mapping and
-column names.
+Include a header line with column names. Enabled by default.
=back
diff --git a/lib/Catmandu/TabularExporter.pm b/lib/Catmandu/TabularExporter.pm
index 9a68557..e36697b 100644
--- a/lib/Catmandu/TabularExporter.pm
+++ b/lib/Catmandu/TabularExporter.pm
@@ -32,6 +32,11 @@ has collect_fields => (
is => 'ro',
);
+has header => (
+ is => 'ro',
+ default => sub { 1 }
+);
+
around add => sub {
my ($orig, $self, $data) = @_;
$self->_set_fields($data) unless $self->fields;
@@ -94,10 +99,10 @@ adds some functionality tailored to tabular or columnar exporters.
=item fields
-The fields to be mapped. Can be an arrayref, example hashref or comma separated
-string. If missing, the fields of the first record encountered will be used. If
-C<collect_fields> is true, all fields names in the record stream will be
-collected first.
+The fields to be mapped. Can be an arrayref, example hashref or comma
+separated string. If missing, the fields of the first record encountered will
+be used. If C<collect_fields> is true, all fields names in the record stream
+will be collected first.
=item columns
@@ -109,6 +114,10 @@ separated string.
See C<fields> for a description. Note that this option will cause all records
in the stream to be buffered in memory.
+=item header
+
+Include a header with column names. Enabled by default.
+
=back
=cut
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libcatmandu-perl.git
More information about the Pkg-perl-cvs-commits
mailing list