GT::TempFile - implements a very simple temp file.
my $file = new GT::TempFile; open (FILE, "> $file"); print FILE "somedata"; close FILE;
GT::TempFile implements a very simple temp file system that will remove itself once the variable goes out of scope.
When you call new, it creates a random file name and looks for a tmp directory. What you get back is an object that when dereferenced is the file name. You can also pass in a temp dir to use:
my $file = new GT::Tempfile '/path/to/tmpfiles';
Other option you may use are: my $file = new GT::TempFile( destroy => 1, prefix => '', tmp_dir => '/tmp' );
When the object is destroyed, it automatically unlinks the temp file unless you specify destroy => 0.
prefix will be prepended to the start of all temp files created and the lock directory that is created. It is used to keep programs using the tempfile module that do not have the temp files destroyed from clashing.
tmp_dir is the same as calling new with just one argument, it is the directory where files will be stored.
TempFile picks a temp directory based on the following:
1. ENV{GT_TMPDIR} 2. ~/tmp 3. ENV{TMPDIR}, ENV{TEMP}, ENV{TMP} 4. /usr/tmp, /var/tmp, c:/temp, /tmp, /temp, /WWW_ROOT, c:/windows/temp, c:/winnt/temp
Copyright (c) 2004 Gossamer Threads Inc. All Rights Reserved. http://www.gossamer-threads.com/
Revision: $Id: TempFile.pm,v 1.36 2005/03/23 04:27:26 jagerman Exp $