[libcatmandu-perl] 10/101: no need for __seen_header__ in CSV exporter

Jonas Smedegaard dr at jones.dk
Tue Feb 23 13:43:48 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 5b858110d53b7db151e81348ef21ce5df195dd6d
Author: Nicolas Steenlant <nicolas.steenlant at ugent.be>
Date:   Thu Dec 10 15:30:10 2015 +0100

    no need for __seen_header__ in CSV exporter
---
 Build.PL                     | 4 ++--
 lib/Catmandu/Exporter.pm     | 2 +-
 lib/Catmandu/Exporter/CSV.pm | 7 +++----
 3 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/Build.PL b/Build.PL
index 55948f9..3cf9dc3 100644
--- a/Build.PL
+++ b/Build.PL
@@ -1,5 +1,5 @@
 
-# This file was automatically generated by Dist::Zilla::Plugin::ModuleBuild v5.039.
+# This file was automatically generated by Dist::Zilla::Plugin::ModuleBuild v5.041.
 use strict;
 use warnings;
 
@@ -15,7 +15,7 @@ my %module_build_args = (
   },
   "dist_abstract" => "a data toolkit",
   "dist_author" => [
-    "Nicolas Steenlant <nicolas.steenlant\@ugent.be>"
+    "Nicolas Steenlant, C<< <nicolas.steenlant at ugent.be> >>"
   ],
   "dist_name" => "Catmandu",
   "dist_version" => "0.9505",
diff --git a/lib/Catmandu/Exporter.pm b/lib/Catmandu/Exporter.pm
index fe06887..9ab3d54 100644
--- a/lib/Catmandu/Exporter.pm
+++ b/lib/Catmandu/Exporter.pm
@@ -107,7 +107,7 @@ An ARRAY of one or more fixes or file scripts to be applied to exported items.
 
 =head2 add
 
-Adds one object to be exported. 
+Adds one object to be exported.
 
 =head2 add_many
 
diff --git a/lib/Catmandu/Exporter/CSV.pm b/lib/Catmandu/Exporter/CSV.pm
index f732ee2..8d7ec3c 100644
--- a/lib/Catmandu/Exporter/CSV.pm
+++ b/lib/Catmandu/Exporter/CSV.pm
@@ -62,12 +62,11 @@ sub add {
         $val;
     } @$fields];
     my $fh = $self->fh;
-    # We need to wait for the first row that can be printed to provide us
-    # with an header...
-    if (!defined($self->{__seen_header__}) && $self->header) {
+    # we need to wait for the first row that can be printed to provide us with
+    # a header
+    if (!$self->count && $self->header) {
         $self->csv->print($fh, ref $self->header ? $self->header : $fields);
     }
-    $self->{__seen_header__} = 1;
     $self->csv->print($fh, $row);
 }
 

-- 
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