Skip Menu |
 

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the CGI CPAN distribution.

Report information
The Basics
Id: 95515
Status: resolved
Priority: 0/
Queue: CGI

People
Owner: Nobody in particular
Requestors: johnson [...] Pharmacy.Arizona.EDU
Cc:
AdminCc:

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



Subject: Odd issue, not entirely sure if it's a bug in Text::CSV_XS
Date: Fri, 9 May 2014 21:38:33 +0000
To: "bug-Text-CSV_XS [...] rt.cpan.org" <bug-Text-CSV_XS [...] rt.cpan.org>
From: Bruce Johnson <johnson [...] Pharmacy.Arizona.EDU>
Download (untitled) / with headers
text/plain 518b
When I’m using a CGI->upload file handle, I get the error: "Undefined subroutine Fh::getline” when I try to use the ‘getline’ method. If I write the uploaded file to a temp file, then open that as an input file handle for Text::CSV_XS it works as expected. I’ve attached two scripts (filetestbroke.pl shows the error in the logs, and nothing in the web browser, and filetestworks.pl works as expected, displaying the contents of the csv file) and a test.csv file that successfully reproduces the error.
Download test.csv
text/csv 56b

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

Download filetestbroke.pl
text/x-perl 890b

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

Download filetestworks.pl
text/x-perl 1.1k

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

Download ATT00001.txt
text/plain 3.8k

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

Subject: Re: [rt.cpan.org #95515] Odd issue, not entirely sure if it's a bug in Text::CSV_XS
Date: Sat, 10 May 2014 12:13:01 +0200
To: bug-Text-CSV_XS [...] rt.cpan.org
From: "H.Merijn Brand" <h.m.brand [...] xs4all.nl>
Download (untitled) / with headers
text/plain 1.4k
On Fri, 9 May 2014 17:39:07 -0400, "Bruce Johnson via RT" <bug-Text-CSV_XS@rt.cpan.org> wrote: CGI defines package Fh: --8<--- CGI.pm#3830 package Fh; use overload '""' => \&asString, 'cmp' => \&compare, 'fallback'=>1; $FH='fh00000'; *Fh::AUTOLOAD = \&CGI::AUTOLOAD; sub DESTROY { my $self = shift; close $self; } -->8--- etc etc Doing what CGI thinks is needed for a file handle. But that package does not support "getline ()", hence Text::CSV_XS cannot invoke it. I can document that as "impossible" for now. It is CGI to blame: a (perlish) file handle should support a getline method to mimic <$fh> Show quoted text
> When I’m using a CGI->upload file handle, I get the error: > > "Undefined subroutine Fh::getline” when I try to use the ‘getline’ method. > > If I write the uploaded file to a temp file, then open that as an input > file handle for Text::CSV_XS it works as expected. > > I’ve attached two scripts (filetestbroke.pl shows the error in the logs, > and nothing in the web browser, and filetestworks.pl works as > expected, displaying the contents of the csv file) and a test.csv file > that successfully reproduces the error.
-- H.Merijn Brand http://tux.nl Perl Monger http://amsterdam.pm.org/ using perl5.00307 .. 5.19 porting perl5 on HP-UX, AIX, and openSUSE http://mirrors.develooper.com/hpux/ http://www.test-smoke.org/ http://qa.perl.org http://www.goldmark.org/jeff/stupid-disclaimers/
Subject: Re: [rt.cpan.org #95515] Odd issue, not entirely sure if it's a bug in Text::CSV_XS
Date: Tue, 20 May 2014 19:00:32 -0700
To: "H.Merijn Brand via RT" <bug-CGI [...] rt.cpan.org>
From: Mark Stosberg <mark [...] stosberg.com>
Download (untitled) / with headers
text/plain 521b
The internals of CGI::Simple here. It uses it IO::File to create the filehandles. It in turn inherits from IO::Handle which has a getline() method, so CGI::Simple doesn't have this issue. I've previously don't work to sync details between CGI and CGI::Simple. It would be nice for CGI.pm to start using IO::File, like CGI::Simple does, but this may break some code which explicitly checks if the filehandle belongs to a "Fh" class. Perhaps making "Fh" an empty sub-class of IO::File would do the trick. Mark
Download (untitled) / with headers
text/plain 241b
This issue has been copied to: https://github.com/leejo/CGI.pm/issues/133 please take all future correspondence there. This ticket will remain open but please do not reply here. This ticket will be closed when the github issue is dealt with.
Download (untitled) / with headers
text/plain 277b
Can you test this with the latest DEV release of CGI (4.04_03)? I have refactored the guts of the temp file handling to use File::Temp so you should now get an object that is both subclass of an empty Fh class, but more importantly a subclass of an IO::Handle and IO::Seekable.
Download (untitled) / with headers
text/plain 154b
I'm considering this issue fixed by recent refactoring to the module to use File::Temp, v4.05 has been sent to CPAN. Unless someone can prove otherwise...


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.