tempnam#

Return a candidate filename under $dir starting with $prefix - does not create the file.

Σύνοψη#

my $name = tempnam('/var/tmp', 'cache_');

Τι επιστρέφεται#

A full path string "$dir/${prefix}XXXXXXXX" with the Xs replaced by random characters. The caller is responsible for opening the file, and there is a race between name selection and open.

Παραδείγματα#

use File::Temp qw/ tempnam /;
my $name = tempnam('/tmp', 'sess-');
open my $fh, '>', $name or die;

Οριακές περιπτώσεις#

  • Wrong arg count: croaks with a usage message.

  • Like mktemp, unsafe against attackers - prefer tempfile.

Διαφορές από το upstream#

Fully compatible with upstream File::Temp 0.2312.

Δείτε επίσης#

  • tempfile - race-safe replacement returning both filehandle and name.

  • mktemp - similar idea with a caller-supplied template.