tmpnam#
POSIX-style tmpnam - in scalar context a candidate filename in the system temp directory; in list context a created file with its filehandle.
Σύνοψη#
my $name = tmpnam(); # scalar: just a name
my ($fh, $name) = tmpnam(); # list: creates the file
Τι επιστρέφεται#
In scalar context a filename string in the system temp directory that does not exist at the moment of the call - there is still a race between picking it and opening it, so prefer tempfile. In list context, a freshly created file is returned along with its filehandle.
Παραδείγματα#
use File::Temp qw/ tmpnam /;
my ($fh, $name) = tmpnam(); # race-free file creation
Οριακές περιπτώσεις#
Scalar context does not create a file - callers must open the name themselves and accept the race.
Διαφορές από το upstream#
Fully compatible with upstream File::Temp 0.2312.
Δείτε επίσης#
tempfile- the recommended race-safe replacement.tmpfile- file is opened and unlinked immediately.mkstemp- template-based creation.