tmpfile#
POSIX-style tmpfile - open an anonymous temporary file and return the filehandle. The file is unlinked immediately.
Σύνοψη#
my $fh = tmpfile();
print $fh "scratch\n";
seek $fh, 0, 0;
Τι επιστρέφεται#
An open read/write filehandle reference. There is no filename to hand out: the file is removed from the directory immediately after opening and exists only as long as $fh is open.
Παραδείγματα#
my $fh = tmpfile();
print $fh "line 1\n";
seek $fh, 0, 0;
my $line = <$fh>; # "line 1\n"
Οριακές περιπτώσεις#
On filesystems that refuse to unlink open files the file stays on disk until
$fhis closed.
Διαφορές από το upstream#
Fully compatible with upstream File::Temp 0.2312.
Δείτε επίσης#
tempfile- gives you both filehandle and filename.tmpnam- returns only a name (or($fh, $name)in list context).