Skip Menu |
 
rt.cpan.org will be shut down on March 1st, 2021.

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

Report information
The Basics
Id: 124344
Status: open
Priority: 0/
Queue: Text-CSV

People
Owner: Nobody in particular
Requestors: lorienstice [...] gmail.com
Cc:
AdminCc:

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

Attachments


MIME-Version: 1.0
X-Spam-Status: No, score=-1.333 tagged_above=-99.9 required=10 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, SPF_SOFTFAIL=0.665] autolearn=no
X-Cpan.org: This message routed through the cpan.org mail forwarding service. Please use PAUSE pause.perl.org to configure your delivery settings.
X-Spam-Flag: NO
Content-Type: multipart/alternative; boundary="089e083155c8519e92056492002c"
Message-ID: <CAETBVStvnectikv8HZ55zE=P83qbJzycfeZ+0aiOKUGqxJirJg [...] mail.gmail.com>
X-Received: by 10.28.118.13 with SMTP id r13mr2865919wmc.95.1517953116903; Tue, 06 Feb 2018 13:38:36 -0800 (PST)
X-Virus-Scanned: Debian amavisd-new at bestpractical.com
X-Spam-Score: -1.333
Received: from localhost (localhost [127.0.0.1]) by hipster.bestpractical.com (Postfix) with ESMTP id 4941D2402B6 for <cpan-bug+Text-CSV [...] hipster.bestpractical.com>; Tue, 6 Feb 2018 16:38:51 -0500 (EST)
Received: from hipster.bestpractical.com ([127.0.0.1]) by localhost (hipster.bestpractical.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Wn9soz+8wmno for <cpan-bug+Text-CSV [...] hipster.bestpractical.com>; Tue, 6 Feb 2018 16:38:49 -0500 (EST)
Received: from xx1.develooper.com (xx1.develooper.com [207.171.7.115]) by hipster.bestpractical.com (Postfix) with ESMTPS id 962AD2401EB for <bug-Text-CSV [...] rt.cpan.org>; Tue, 6 Feb 2018 16:38:49 -0500 (EST)
Received: from localhost (xx1.develooper.com [127.0.0.1]) by localhost (Postfix) with ESMTP id 761BD11ED63 for <bug-Text-CSV [...] rt.cpan.org>; Tue, 6 Feb 2018 13:38:48 -0800 (PST)
Received: from xx1.develooper.com (xx1.develooper.com [127.0.0.1]) by localhost (Postfix) with SMTP id 401D211FA30 for <bug-Text-CSV [...] rt.cpan.org>; Tue, 6 Feb 2018 13:38:46 -0800 (PST)
Received: from mail-wm0-f53.google.com (mail-wm0-f53.google.com [74.125.82.53]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by xx1.develooper.com (Postfix) with ESMTPS id 3C6CC11ED63 for <bug-Text-CSV [...] rt.cpan.org>; Tue, 6 Feb 2018 13:38:38 -0800 (PST)
Received: by mail-wm0-f53.google.com with SMTP id t74so6489018wme.3 for <bug-Text-CSV [...] rt.cpan.org>; Tue, 06 Feb 2018 13:38:38 -0800 (PST)
Received: by 10.28.92.66 with HTTP; Tue, 6 Feb 2018 13:38:36 -0800 (PST)
Authentication-Results: hipster.bestpractical.com (amavisd-new); dkim=pass header.i= [...] gmail.com
X-Google-SMTP-Source: AH8x2272fxL4C6YNr9yyAfd03+UlVnVbZMXC8b5kdd9g+HCaYFFElTi6FbCRDBwzpEl3Ju4s0uFdx3sghJOqCBhXZ+Y=
Delivered-To: cpan-bug+Text-CSV [...] hipster.bestpractical.com
Subject: Text::CSV problem/question
Return-Path: <elcilorien [...] gmail.com>
X-RT-Mail-Extension: text-csv
X-Original-To: cpan-bug+Text-CSV [...] hipster.bestpractical.com
Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:from:date:message-id:subject:to; bh=8XdhA+4PRR5eKRf40S8iBXEITc3QED8HaEeowuT7xLk=; b=TsBBqE9Wwh16gI/Bn9n/nCitAbAtLoWMdFOvTI/RmPjX6kntDooVDryFamoe2GDgtD rSsCTwWYdlCty4sWePRPi6o+DpRlAKRuM+9ISNgwh25a5xHYCH/IYt/hABYmMhvGYnxR DsK7g4KYES7sGgyTPudslM5EYdMxhzb7js2k5zLo8xlpTNwCEBf+zghBHbnNpfOu+FkU e8DZEqcdjWHS+xbfENlf1fT4gcBayUXiNvkqoFUMJYNAiyUohniBNpNZB5Liu+i/kZBN z7Ca8+lyj1qNz8wwvQBmDjRWWXvuUBQjbnqqaj1XxJGl93IZaelwvHIwfcpB0PJ1kTSE XOSw==
X-Google-Sender-Auth: Lm2miYB8hLXGjPd6uZwdvlTWkNA
X-Google-Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:from:date:message-id:subject :to; bh=8XdhA+4PRR5eKRf40S8iBXEITc3QED8HaEeowuT7xLk=; b=gD7EO+9Len59wBwozSFA8XqK4m6fBsA6SAmb5iZt/Zs2pl2obvnS9FU8kOjdOJTWpj I/TKYnNdUQ50NLZEOB6g+iGwO1ar+zVpEuuj22Hv18tl5El5nUm8dcP8uwcvolTURXWT axGszuRewz24XGy2jdG3FRp+1bBBFzkUer1oPcMF/zI575hbzVUiIzDmjLS2x1u96tCZ lmflXXiKHuP30cvSFFk2bnJkg9WtWSk/zQlsmjK1vZblhF76Yqn87WrBd1Z+yLTt38GP pWph6gRbgTnu3TxbcvfL3ypjm/2BUIeZxOBp9gpKERi3/FY6ejpvr7saMLUbkilqycSG 3GqQ==
X-PMX-Spam: Gauge=IIIIIIII, Probability=8%, Report=' HTML_NO_HTTP 0.1, BODYTEXTH_SIZE_10000_LESS 0, BODYTEXTP_SIZE_3000_LESS 0, BODY_SIZE_4000_4999 0, BODY_SIZE_5000_LESS 0, BODY_SIZE_7000_LESS 0, DATE_TZ_NA 0, DKIM_SIGNATURE 0, NO_CTA_URI_FOUND 0, NO_URI_FOUND 0, NO_URI_HTTPS 0, SPF_PASS 0, WEBMAIL_SOURCE 0, __CT 0, __CTYPE_HAS_BOUNDARY 0, __CTYPE_MULTIPART 0, __CTYPE_MULTIPART_ALT 0, __DQ_NEG_HEUR 0, __DQ_NEG_IP 0, __FRAUD_MONEY_CURRENCY 0, __FRAUD_MONEY_CURRENCY_DOLLAR 0, __FRAUD_WEBMAIL 0, __FRAUD_WEBMAIL_FROM 0, __FRAUD_WEBMAIL_SENDER 0, __FROM_GMAIL 0, __HAS_FROM 0, __HAS_HTML 0, __HAS_MSGID 0, __HELO_GMAIL 0, __HEX28_LC_BOUNDARY 0, __HIGHBITS 0, __HTML_TAG_DIV 0, __LINES_OF_YELLING 0, __MIME_HTML 0, __MIME_TEXT_H 0, __MIME_TEXT_H1 0, __MIME_TEXT_H2 0, __MIME_TEXT_P 0, __MIME_TEXT_P1 0, __MIME_TEXT_P2 0, __MIME_VERSION 0, __PHISH_SPEAR_HTTP_RECEIVED 0, __PHISH_SPEAR_STRUCTURE_1 0, __RDNS_GMAIL 0, __SANE_MSGID 0, __TO_MALFORMED_2 0, __TO_NO_NAME 0, __YOUTUBE_RCVD 0, __zen.spamhaus.org_ERROR '
Date: Tue, 6 Feb 2018 13:38:36 -0800
Sender: elcilorien [...] gmail.com
X-Spam-Level:
X-PMX-Version: 5.6.1.2065439, Antispam-Engine: 2.7.2.376379, Antispam-Data: 2018.2.6.213016
To: bug-Text-CSV [...] rt.cpan.org
From: Lorien Stice-Lawrence <lorienstice [...] gmail.com>
X-GM-Message-State: APf1xPDI4Qd5uWIJnEcWFjXLYGvTifeqoiTZG87/rT2KGCVOY6cJUTqo EiqjMeuJeDHxwtLmD3VYTw8FwdW4xoJ6fQBtKtPUZw==
X-RT-Interface: Email
Content-Length: 0
content-type: text/plain; charset="utf-8"
X-RT-Original-Encoding: utf-8
Content-Length: 1677
Download (untitled) / with headers
text/plain 1.6k
Hi, Thanks for putting together such a useful module. I've used it in many programs in the past. In the past it used to be the case that when I was printing to a CSV file throughout my program (i.e. once at the beginning to print the labels, and then looping through items and printing a line at a time) the output csv file was continuously being edited as my program ran and I could always peak inside the file to make sure the output looked right. Similarly, if the program ran into a problem and failed (for a reason unrelated to Text::CSV) I would still have all of the output I'd printed from the previous loops. However, now no content is printed to the csv file until the entire program has ended running, and if the program stops prematurely (for a non-Text::CSV-related reason) none of the output has been printed to the file at all. I'm at a loss as to why this is happening because I'm using the same structure that I always have. This is the basic structure of the loop I'm using. Is my issue due to a change to Text::CSV or have I somehow been lucking out before? Lorien use Text::CSV; my @rows; my $csv = Text::CSV->new ( { binary => 1, eol => "\n", auto_diag => 1 } ) or die "Cannot use CSV: ".Text::CSV->error_diag (); open(my $mycsv, ">", $outputfile) or die "$outputfile: $!"; my @columns=('var1', 'var1','var3'); $csv->print ($mycsv, [@columns]); #loop opendir (DIR, $folder) or die $!; while (my $now_file = readdir (DIR)){ #various calculations which create $var, $var2, and $var3 #PRINT ALL OUTPUT TO A CSV FILE# @my_array= ($var1, $var2,$var3); $csv-> print ($mycsv, [@my_array]); } closedir DIR; close $mycsv or die "$!";
content-type: text/html; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
X-RT-Original-Encoding: utf-8
Content-Length: 2229
MIME-Version: 1.0
In-Reply-To: <CAETBVStvnectikv8HZ55zE=P83qbJzycfeZ+0aiOKUGqxJirJg [...] mail.gmail.com>
X-Mailer: MIME-tools 5.504 (Entity 5.504)
Content-Disposition: inline
X-RT-Interface: Web
References: <CAETBVStvnectikv8HZ55zE=P83qbJzycfeZ+0aiOKUGqxJirJg [...] mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
Message-ID: <rt-4.0.18-23090-1517982223-1624.124344-0-0 [...] rt.cpan.org>
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
X-RT-Encrypt: 0
X-RT-Sign: 0
Content-Length: 2135
On Wed Feb 07 06:38:52 2018, lorienstice@gmail.com wrote: Show quoted text
> Hi, > > Thanks for putting together such a useful module. I've used it in many > programs in the past. In the past it used to be the case that when I was > printing to a CSV file throughout my program (i.e. once at the beginning to > print the labels, and then looping through items and printing a line at a > time) the output csv file was continuously being edited as my program ran > and I could always peak inside the file to make sure the output looked > right. Similarly, if the program ran into a problem and failed (for a > reason unrelated to Text::CSV) I would still have all of the output I'd > printed from the previous loops. However, now no content is printed to the > csv file until the entire program has ended running, and if the program > stops prematurely (for a non-Text::CSV-related reason) none of the output > has been printed to the file at all. I'm at a loss as to why this is > happening because I'm using the same structure that I always have.
Could you show us a bit more basic info? - Which version of Text::CSV you use (and the one of Text::CSV_XS if you have)? - Around when is the "past"? (ie. do you remember about which version you used before?) - Do you have a sample CSV file that can reproduce your issue with the latest Text::CSV(_XS)? Show quoted text
> > This is the basic structure of the loop I'm using. Is my issue due to a > change to Text::CSV or have I somehow been lucking out before? > > Lorien > > use Text::CSV; > > my @rows; > my $csv = Text::CSV->new ( { binary => 1, eol => "\n", auto_diag => 1 } ) > or die "Cannot use CSV: ".Text::CSV->error_diag (); > open(my $mycsv, ">", $outputfile) or die "$outputfile: $!"; > > my @columns=('var1', 'var1','var3'); > $csv->print ($mycsv, [@columns]); > > > #loop > opendir (DIR, $folder) or die $!; > while (my $now_file = readdir (DIR)){ > > #various calculations which create $var, $var2, and $var3 > > > #PRINT ALL OUTPUT TO A CSV FILE# > @my_array= ($var1, $var2,$var3); > $csv-> print ($mycsv, [@my_array]); > } > > closedir DIR; > close $mycsv or die "$!";
MIME-Version: 1.0
X-Spam-Status: No, score=-5.333 tagged_above=-99.9 required=10 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, FROM_OUR_RT=-4, HTML_MESSAGE=0.001, SPF_SOFTFAIL=0.665] autolearn=ham
In-Reply-To: <rt-4.0.18-23090-1517982223-639.124344-6-0 [...] rt.cpan.org>
X-Cpan.org: This message routed through the cpan.org mail forwarding service. Please use PAUSE pause.perl.org to configure your delivery settings.
X-Spam-Flag: NO
X-RT-Interface: API
References: <RT-Ticket-124344 [...] rt.cpan.org> <CAETBVStvnectikv8HZ55zE=P83qbJzycfeZ+0aiOKUGqxJirJg [...] mail.gmail.com> <rt-4.0.18-23090-1517982223-639.124344-6-0 [...] rt.cpan.org>
X-Virus-Scanned: Debian amavisd-new at bestpractical.com
X-Received: by 10.223.201.3 with SMTP id m3mr3375577wrh.117.1518216714205; Fri, 09 Feb 2018 14:51:54 -0800 (PST)
Message-ID: <CAETBVStQhx-wAF2c5BGhLpWZc7RX0gzYorq2U-em_hCCOPrFtA [...] mail.gmail.com>
Content-Type: multipart/mixed; boundary="089e082fa340f18ed10564cf5f36"
X-Spam-Score: -5.333
X-Google-SMTP-Source: AH8x2246WE3VMFyKTpgt/V5tqldRWIH3xaxMlwyVwrt8WZQry/20vJyexHmo1r+Nd9Fu0CIgk/RjIk7yln5u5HPstl4=
Authentication-Results: hipster.bestpractical.com (amavisd-new); dkim=pass header.i= [...] gmail.com
Received: from localhost (localhost [127.0.0.1]) by hipster.bestpractical.com (Postfix) with ESMTP id AC1982402D1 for <cpan-bug+Text-CSV [...] hipster.bestpractical.com>; Fri, 9 Feb 2018 17:52:14 -0500 (EST)
Received: from hipster.bestpractical.com ([127.0.0.1]) by localhost (hipster.bestpractical.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Uhle2msVHWW8 for <cpan-bug+Text-CSV [...] hipster.bestpractical.com>; Fri, 9 Feb 2018 17:52:11 -0500 (EST)
Received: from xx1.develooper.com (xx1.develooper.com [207.171.7.115]) by hipster.bestpractical.com (Postfix) with ESMTPS id B4BA52401A9 for <bug-Text-CSV [...] rt.cpan.org>; Fri, 9 Feb 2018 17:52:10 -0500 (EST)
Received: from localhost (xx1.develooper.com [127.0.0.1]) by localhost (Postfix) with ESMTP id 5BB9411ECFF for <bug-Text-CSV [...] rt.cpan.org>; Fri, 9 Feb 2018 14:52:09 -0800 (PST)
Received: from xx1.develooper.com (xx1.develooper.com [127.0.0.1]) by localhost (Postfix) with SMTP id 15BFA11EBF8 for <bug-Text-CSV [...] rt.cpan.org>; Fri, 9 Feb 2018 14:52:05 -0800 (PST)
Received: from mail-wr0-f172.google.com (mail-wr0-f172.google.com [209.85.128.172]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by xx1.develooper.com (Postfix) with ESMTPS id 37B0511ECFF for <bug-Text-CSV [...] rt.cpan.org>; Fri, 9 Feb 2018 14:51:56 -0800 (PST)
Received: by mail-wr0-f172.google.com with SMTP id 111so6839715wrb.13 for <bug-Text-CSV [...] rt.cpan.org>; Fri, 09 Feb 2018 14:51:55 -0800 (PST)
Received: by 10.28.92.66 with HTTP; Fri, 9 Feb 2018 14:51:53 -0800 (PST)
Delivered-To: cpan-bug+Text-CSV [...] hipster.bestpractical.com
Subject: Re: [rt.cpan.org #124344] Text::CSV problem/question
Return-Path: <elcilorien [...] gmail.com>
Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to; bh=LuesGwvSuNpxnlrakzgEXRL7QYEe8TZ50X+IzqkPR/0=; b=tZo5uSlMIIp+oHsLHln8jEcYbnDYeAijEWkDPDIcJWBZpcKcmH8vo6wrrRPrhEFrGl yX9rrbwMCgVoTEX0ysKd1KCxgCWSDQr9evedbtyIvZ0PqktgJJUE9Dp9mXMxf7bBFtWL n+nn4nXyMO146X1Eqc2/s05l1e/6W6VkQgapqLp9anqZobN3qeJzsjRB3/OPGQKXkewO /T/Gu5uvG9slAdW+XlLj53ED5/oD0Dm8GyP0MpIl+JEHUkLjblU72a2sbDlyJcMwsMzu v+5jiqPOIpZfQxaXYNiW3Fa8BsOxoJDIUf/h5rILVpmUzuCFS5ivcdJuxJEWhQIXdmJ5 Z3hg==
X-Original-To: cpan-bug+Text-CSV [...] hipster.bestpractical.com
X-RT-Mail-Extension: text-csv
X-Google-Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to; bh=LuesGwvSuNpxnlrakzgEXRL7QYEe8TZ50X+IzqkPR/0=; b=ftAu0L+OcnsYytxqt1Ou7nUqlq1OL2jytIgPpWXc0+3XNkoH6TkltVJ9gmCqMIZKA8 hucOZepUbrrS3QldDMKuUC3Pige0sF2zPNCZoyaQM9twQLYqQLfNEQWdA4/fZyB3sjf0 rooTB4WD/voNrAHHX3PAgEEbcihIpVuBEvh6Utx8/DQmMUSaK5hSJZXBOxxkkEbnjEbZ VSkpZpxVDgrEUM4R4pv/glo5DV1Er/nbOGR7dZKmdA63e67QNuVFdRwoz96nXypHa4/y +cGbNW0DHWzC6e/K/k5E9mD02ohNz6vBH+d78xc+NNyChosbpxeFqbVtW66sOywhHfqB 4S+w==
X-Google-Sender-Auth: -TaqMvwx2XibHOeb56-drX7heHM
Sender: elcilorien [...] gmail.com
Date: Fri, 9 Feb 2018 14:51:53 -0800
X-PMX-Spam: Gauge=IIIIIIII, Probability=8%, Report=' BODYTEXTH_SIZE_10000_LESS 0, BODYTEXTH_SIZE_3000_MORE 0, BODY_SIZE_10000_PLUS 0, DATE_TZ_NA 0, DKIM_SIGNATURE 0, IN_REP_TO 0, LEGITIMATE_SIGNS 0, MSG_THREAD 0, REFERENCES 0, SPF_PASS 0, URI_ENDS_IN_HTML 0, WEBMAIL_SOURCE 0, __ANY_URI 0, __BOUNCE_CHALLENGE_SUBJ 0, __BOUNCE_NDR_SUBJ_EXEMPT 0, __CP_URI_IN_BODY 0, __CT 0, __CTYPE_HAS_BOUNDARY 0, __CTYPE_MULTIPART 0, __CTYPE_MULTIPART_MIXED 0, __DQ_NEG_HEUR 0, __DQ_NEG_IP 0, __FORWARDED_MSG 0, __FRAUD_BODY_WEBMAIL 0, __FRAUD_MONEY_CURRENCY 0, __FRAUD_MONEY_CURRENCY_DOLLAR 0, __FRAUD_WEBMAIL 0, __FRAUD_WEBMAIL_FROM 0, __FRAUD_WEBMAIL_SENDER 0, __FROM_GMAIL 0, __HAS_ATTACHMENT 0, __HAS_ATTACHMENT1 0, __HAS_FROM 0, __HAS_HTML 0, __HAS_MSGID 0, __HELO_GMAIL 0, __HEX28_LC_BOUNDARY 0, __HIGHBITS 0, __HTML_AHREF_TAG 0, __HTML_TAG_DIV 0, __HTTPS_URI 0, __IN_REP_TO 0, __LINES_OF_YELLING 0, __MIME_HTML 0, __MIME_TEXT_H 0, __MIME_TEXT_H1 0, __MIME_TEXT_H2 0, __MIME_TEXT_P 0, __MIME_TEXT_P1 0, __MIME_TEXT_P2 0, __MIME_VERSION 0, __MULTIPLE_URI_TEXT 0, __PHISH_SPEAR_HTTP_RECEIVED 0, __PHISH_SPEAR_STRUCTURE_1 0, __RATWARE_SIGNATURE_3_N1 0, __RDNS_GMAIL 0, __REFERENCES 0, __SANE_MSGID 0, __SUBJ_ALPHA_NEGATE 0, __TO_MALFORMED_2 0, __TO_NO_NAME 0, __URI_IN_BODY 0, __URI_NOT_IMG 0, __URI_NO_WWW 0, __URI_NS , __URI_WITHOUT_PATH 0, __URI_WITH_PATH 0, __YOUTUBE_RCVD 0, __zen.spamhaus.org_ERROR '
X-Spam-Level:
X-PMX-Version: 5.6.1.2065439, Antispam-Engine: 2.7.2.376379, Antispam-Data: 2018.2.9.224516
To: bug-Text-CSV [...] rt.cpan.org
X-GM-Message-State: APf1xPDqCOH1aC+LK2hYSoTa2wkyeGAlEHU+Z8lF+jAyRgZYciLnwD9P 3IGxnYNRPdli1rzLREaPWacwN1DIFUh0tOExKTg=
From: Lorien Stice-Lawrence <lorienstice [...] gmail.com>
RT-Message-ID: <rt-4.0.18-28179-1518216735-805.124344-0-0 [...] rt.cpan.org>
Content-Length: 0
Content-Type: multipart/alternative; boundary="089e082fa340f18ecf0564cf5f34"
Content-Length: 0
content-type: text/plain; charset="utf-8"
X-RT-Original-Encoding: utf-8
Content-Length: 3387
Download (untitled) / with headers
text/plain 3.3k
Hi Kenichi, Thanks for getting back to me! In response to your questions: - I'm using version 1.95; both on Windows and also in a Linux environment (I have the same issue in both places). - I used Text::CSV in a program about a month ago and did not have this issue. - I've attached a file that I created with Text::CSV that suffered from this problem; i.e., while the Perl program was still running this file had a filesize of 0 and would be completely blank when you opened it. Not even labels printed in the first row, which I always do before looping through operations, were printed until the entire program had finished running. So there's nothing wrong with this file; it's just that this file is not populated at all until Perl has completely finished running. I can't attached any of the 0 byte files to this e-mail because Gmail won't let me (because they are completely empty) but there is definitely nothing in them. Thanks! Lorien On Tue, Feb 6, 2018 at 9:43 PM, Kenichi Ishigaki via RT < bug-Text-CSV@rt.cpan.org> wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=124344 > > > On Wed Feb 07 06:38:52 2018, lorienstice@gmail.com wrote:
> > Hi, > > > > Thanks for putting together such a useful module. I've used it in many > > programs in the past. In the past it used to be the case that when I was > > printing to a CSV file throughout my program (i.e. once at the beginning
> to
> > print the labels, and then looping through items and printing a line at a > > time) the output csv file was continuously being edited as my program ran > > and I could always peak inside the file to make sure the output looked > > right. Similarly, if the program ran into a problem and failed (for a > > reason unrelated to Text::CSV) I would still have all of the output I'd > > printed from the previous loops. However, now no content is printed to
> the
> > csv file until the entire program has ended running, and if the program > > stops prematurely (for a non-Text::CSV-related reason) none of the output > > has been printed to the file at all. I'm at a loss as to why this is > > happening because I'm using the same structure that I always have.
> > Could you show us a bit more basic info? > > - Which version of Text::CSV you use (and the one of Text::CSV_XS if you > have)? > - Around when is the "past"? (ie. do you remember about which version you > used before?) > - Do you have a sample CSV file that can reproduce your issue with the > latest Text::CSV(_XS)? >
> > > > This is the basic structure of the loop I'm using. Is my issue due to a > > change to Text::CSV or have I somehow been lucking out before? > > > > Lorien > > > > use Text::CSV; > > > > my @rows; > > my $csv = Text::CSV->new ( { binary => 1, eol => "\n", auto_diag => 1 } ) > > or die "Cannot use CSV: ".Text::CSV->error_diag (); > > open(my $mycsv, ">", $outputfile) or die "$outputfile: $!"; > > > > my @columns=('var1', 'var1','var3'); > > $csv->print ($mycsv, [@columns]); > > > > > > #loop > > opendir (DIR, $folder) or die $!; > > while (my $now_file = readdir (DIR)){ > > > > #various calculations which create $var, $var2, and $var3 > > > > > > #PRINT ALL OUTPUT TO A CSV FILE# > > @my_array= ($var1, $var2,$var3); > > $csv-> print ($mycsv, [@my_array]); > > } > > > > closedir DIR; > > close $mycsv or die "$!";
> > > >
content-type: text/html; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
X-RT-Original-Encoding: utf-8
Content-Length: 4390
Content-Type: text/csv; charset="US-ASCII"; name="fin_constraint_phrase_counts_PRT_HPC2.csv"
X-Attachment-ID: f_jdgiweha0
Content-Disposition: attachment; filename="fin_constraint_phrase_counts_PRT_HPC2.csv"
Content-Transfer-Encoding: base64
X-RT-Original-Encoding: ascii
Content-Length: 11126

Message body is not shown because sender requested not to inline it.

MIME-Version: 1.0
In-Reply-To: <rt-4.0.18-28179-1518216735-805.124344-0-0 [...] rt.cpan.org>
X-Mailer: MIME-tools 5.504 (Entity 5.504)
Content-Disposition: inline
X-RT-Interface: Web
References: <RT-Ticket-124344 [...] rt.cpan.org> <CAETBVStvnectikv8HZ55zE=P83qbJzycfeZ+0aiOKUGqxJirJg [...] mail.gmail.com> <rt-4.0.18-23090-1517982223-639.124344-6-0 [...] rt.cpan.org> <CAETBVStQhx-wAF2c5BGhLpWZc7RX0gzYorq2U-em_hCCOPrFtA [...] mail.gmail.com> <rt-4.0.18-28179-1518216735-805.124344-0-0 [...] rt.cpan.org>
Content-Type: text/plain; charset="utf-8"
Message-ID: <rt-4.0.18-10076-1518268276-178.124344-0-0 [...] rt.cpan.org>
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
X-RT-Encrypt: 0
X-RT-Sign: 0
Content-Length: 4177
On Sat Feb 10 07:52:15 2018, lorienstice@gmail.com wrote: Show quoted text
> Hi Kenichi, > > Thanks for getting back to me! In response to your questions: > > > - I'm using version 1.95; both on Windows and also in a Linux > environment (I have the same issue in both places). > - I used Text::CSV in a program about a month ago and did not have > this > issue.
1. Because Text::CSV has not been released since last April and you said you didn't see this issue about a month ago, it most probably is your problem (unless you updated Text::CSV_XS quite recently which I doubt). 2. Considering your explanation and the code example you showed above, it looks like you happen to have forgotten to enable autoflush for your output handle. Add $mycsv->autoflush(1); or something equivalent after you open a file to output and see. Show quoted text
> - I've attached a file that I created with Text::CSV that suffered > from > this problem; i.e., while the Perl program was still running this file > had > a filesize of 0 and would be completely blank when you opened it. Not > even > labels printed in the first row, which I always do before looping > through > operations, were printed until the entire program had finished > running. So > there's nothing wrong with this file; it's just that this file is not > populated at all until Perl has completely finished running. I can't > attached any of the 0 byte files to this e-mail because Gmail won't > let me > (because they are completely empty) but there is definitely nothing in > them. > > Thanks! > > Lorien > > On Tue, Feb 6, 2018 at 9:43 PM, Kenichi Ishigaki via RT < > bug-Text-CSV@rt.cpan.org> wrote: >
> > <URL: https://rt.cpan.org/Ticket/Display.html?id=124344 > > > > > On Wed Feb 07 06:38:52 2018, lorienstice@gmail.com wrote:
> > > Hi, > > > > > > Thanks for putting together such a useful module. I've used it in > > > many > > > programs in the past. In the past it used to be the case that when > > > I was > > > printing to a CSV file throughout my program (i.e. once at the > > > beginning
> > to
> > > print the labels, and then looping through items and printing a > > > line at a > > > time) the output csv file was continuously being edited as my > > > program ran > > > and I could always peak inside the file to make sure the output > > > looked > > > right. Similarly, if the program ran into a problem and failed (for > > > a > > > reason unrelated to Text::CSV) I would still have all of the output > > > I'd > > > printed from the previous loops. However, now no content is printed > > > to
> > the
> > > csv file until the entire program has ended running, and if the > > > program > > > stops prematurely (for a non-Text::CSV-related reason) none of the > > > output > > > has been printed to the file at all. I'm at a loss as to why this > > > is > > > happening because I'm using the same structure that I always have.
> > > > Could you show us a bit more basic info? > > > > - Which version of Text::CSV you use (and the one of Text::CSV_XS if > > you > > have)? > > - Around when is the "past"? (ie. do you remember about which version > > you > > used before?) > > - Do you have a sample CSV file that can reproduce your issue with > > the > > latest Text::CSV(_XS)? > >
> > > > > > This is the basic structure of the loop I'm using. Is my issue due > > > to a > > > change to Text::CSV or have I somehow been lucking out before? > > > > > > Lorien > > > > > > use Text::CSV; > > > > > > my @rows; > > > my $csv = Text::CSV->new ( { binary => 1, eol => "\n", auto_diag => > > > 1 } ) > > > or die "Cannot use CSV: ".Text::CSV->error_diag > > > (); > > > open(my $mycsv, ">", $outputfile) or die "$outputfile: $!"; > > > > > > my @columns=('var1', 'var1','var3'); > > > $csv->print ($mycsv, [@columns]); > > > > > > > > > #loop > > > opendir (DIR, $folder) or die $!; > > > while (my $now_file = readdir (DIR)){ > > > > > > #various calculations which create $var, $var2, and $var3 > > > > > > > > > #PRINT ALL OUTPUT TO A CSV FILE# > > > @my_array= ($var1, $var2,$var3); > > > $csv-> print ($mycsv, [@my_array]); > > > } > > > > > > closedir DIR; > > > close $mycsv or die "$!";
> > > > > > > >


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

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