mkstemps#
Create a file from a template with a literal suffix preserved at the end of the name.
תקציר#
my ($fh, $path) = mkstemps('/tmp/dataXXXXXX', '.log');
## $path looks like /tmp/dataAb3c9F.log
מה מוחזר#
In list context ($fh, $path); in scalar context just the filehandle. The suffix is appended to the template before filling, and the Xs before it are the ones replaced.
דוגמאות#
use File::Temp qw/ mkstemps /;
my ($fh, $path) = mkstemps('/var/tmp/rpt-XXXXXX', '.json');
מקרי קצה#
The suffix is a literal string, not a length count.
Template with fewer than four trailing
Xs before the suffix: croaks.Wrong arg count: croaks with a usage message.
הבדלים מן ה-upstream#
Fully compatible with upstream File::Temp 0.2312.
ראו גם#
mkstemp- same idea, no suffix handling.tempfile- useSUFFIX => ...for a named-option form.