Do you want to patch File::Temp to make this work properly on Win32 (I
don't know the API so never implemented something like that). If I recall
correctly Pod::Perldoc started off using File::Temp until problems with
win32 temp files turned up. Maybe if File::Temp was fixed on win32
Pod::Perldoc could switch back to using it.
Tim
On Fri, 5 Aug 2005, demerphq wrote:
On 8/3/05, Randy W. Sims <[EMAIL PROTECTED]> wrote:
Piotr Fusik (via RT) wrote:
# New Ticket Created by "Piotr Fusik"
# Please include the string: [perl #36766]
# in the subject line of all future correspondence about this issue.
# <URL: https://rt.perl.org/rt3/Ticket/Display.html?id=36766 >
This is a bug report for perl from [EMAIL PROTECTED],
generated with the help of perlbug 1.35 running under perl v5.8.7.
-----------------------------------------------------------------
It seems that perldoc creates temporary files in \WINDOWS\TEMP,
but doesn't delete them upon exit.
This is not a bug.
Actually it IS a bug. Even if its a known bug deliberately left in place.
I don't recall the specific reason, but temp files
are kept for a period of time. I think it has something to do with the
file locking semantics of the temp files created under Windows such that
they can't be unlinked under certain conditions, but my memory is known
to be quite faulty and occasionally makes up stuff.
This only holds true for files opened using "normal" perl file opening
mechanisms as the unixy style file opens dont allow for Win32 users to
exploit Win32 specific mechanisms for achieving this.
use Win32API::File;
$hTemp= createFile( "$ENV{Temp}/temp.$$", "wn", "",
{ Attributes=>"hst", Flags=>FILE_FLAG_DELETE_ON_CLOSE() } )
or die "Can't create temporary file, temp.$$: $^E\n";
will create a file that is marked as temporary and which will be
automatically deleted when the handle is closed. Marking it as a
temporary file means that if at all possible the OS will keep the
entire file in cache and avoid writing it to disk, meaning that using
the file is more efficient.
As an aside its a real pity we cant access this type of functionality
via the normal open semantics.
Ie, something like:
open my $fh,"!","temp_file" or die "Failed to open:$!";
unlink "temp_file"; # this makes unix systems unlink the file immediately,
# the "!" open modifier makes it delete on
close on Win32
# systems where this is not allowed.
Of course on systems without this style of opening semantics the "!"
modifier would be ignored. Although for sanity reasons I would make
this only happen with a three arg open.
cheers,
yves
--
Tim Jenness
JAC software
http://www.jach.hawaii.edu/~timj