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

Report information
The Basics
Id:
38960
Status:
resolved
Priority:
Low/Low
Queue:

People
Owner:
HMBRAND [...] cpan.org
Requestors:
ilmari [...] ilmari.org
Cc:
AdminCc:

BugTracker
Severity:
Important
Broken in:
0.23
Fixed in:
0.54



Subject: print() on invalid filehandle warns and returns success
Date: Wed, 03 Sep 2008 19:44:20 +0100
To: bug-Text-CSV_XS@rt.cpan.org
From: ilmari@ilmari.org (Dagfinn Ilmari Mannsåker)
Hi Merijn, I noticed $csv->print($fh, \@fields) ignores errors that occur when writing to $fh. Instead it gives a "Use of unititialized value in subroutine" error and returns 1. The below script demonstrates this when passed an unwritable file, such as /dev/full, when it produces the following output:
Show quoted text
> $fh->print("testing"): No space left on device > Use of uninitialized value in subroutine entry at /home/ilmari/tmp/csv-print.pl line 16. > $csv->print($fh, ["testing"]): ok
Here's the script: #!/usr/bin/perl use strict; use warnings; use Text::CSV_XS; use IO::Handle; my $csv = Text::CSV_XS->new; open my $fh, '>', shift or die "open: $!\n"; $fh->autoflush(1); print '$fh->print("testing"): '; $fh->print("testing") and print "ok\n" or print "$!\n"; print '$csv->print($fh, ["testing"]): '; $csv->print($fh, ["testing"]) and print "ok\n" or print $csv->error_diag; -- ilmari "A disappointingly low fraction of the human race is, at any given time, on fire." - Stig Sandbeck Mathisen


This service runs on Request Tracker, is sponsored by The Perl Foundation, and maintained by Best Practical Solutions.

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