Skip Menu |

This queue is for tickets about the File-Temp CPAN distribution.

Report information
The Basics
Id: 45000
Status: resolved
Priority: 0/
Queue: File-Temp

People
Owner: Nobody in particular
Requestors: SMPETERS [...] cpan.org
Cc:
AdminCc:

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



Subject: Reported in perlbug...#64350: File::Temp offers wrong advice
From http://rt.perl.org/rt3/Ticket/Display.html?id=64350... File::Temp offers advice on how to fool code that thinks it wants a filename into accepting a file descriptor instead. Unfortunately this advice will not work with Perl code that uses the 3-arg form of open, which is becoming ever more popular. The following documentation patch against the version of File::Temp in Perl 5.10 fixes that. Cheers, Ben --- lib/File/Temp.pm.bak 2009-04-01 09:44:32.000000000 -0700 +++ lib/File/Temp.pm 2009-04-01 09:50:24.000000000 -0700 @@ -199,7 +199,7 @@ # Version number -$VERSION = '0.18'; +$VERSION = '0.19'; # This is a list of characters that can be used in random filenames @@ -2201,10 +2201,12 @@ dispense with the filename altogether. If you need to pass the handle to something that expects a filename -then, on a unix system, use C<"/dev/fd/" . fileno($fh)> for arbitrary -programs, or more generally C<< "+<=&" . fileno($fh) >> for Perl -programs. You will have to clear the close-on-exec bit on that file -descriptor before passing it to another process. +then on a unix system you can use C<"/dev/fd/" . fileno($fh)> for +arbitrary programs. Perl code that uses the 2-argument version of +C<< open >> can be passed C<< "+<=&" . fileno($fh) >>. Otherwise you +will need to pass the filename. You will have to clear the +close-on-exec bit on that file descriptor before passing it to another +process. use Fcntl qw/F_SETFD F_GETFD/; fcntl($tmpfh, F_SETFD, 0)
Fixed in git repository. Will be released when CPAN is next updated.