Lines Matching refs:template

49   ($fh, $filename) = tempfile( $template, DIR => $dir);
50 ($fh, $filename) = tempfile( $template, SUFFIX => '.dat');
59 $fh = new File::Temp($template);
74 $tmpdir = mkdtemp( $template );
76 $unopened_file = mktemp( $template );
191 # Minimum number of X characters that should be in a template
194 # Default template when no template supplied
252 # The template must contain X's that are to be replaced
286 # ($fh, $name) = _gettemp($template, "open" => 1);
293 croak 'Usage: ($fh, $name) = _gettemp($template, OPTIONS);'
310 # Read the template
311 my $template = shift;
312 if (ref($template)) {
314 carp "File::Temp::_gettemp: template must not be a reference";
339 my $start = length($template) - 1 - $options{"suffixlen"};
347 if (substr($template, $start - MINX + 1, MINX) ne 'X' x MINX) {
348 ${$options{ErrStr}} = "The template must contain at least ".
357 # and generate a full path from the template
359 my $path = _replace_XX($template, $options{"suffixlen"});
377 # If @dirs only has one entry (i.e. the directory template) that means
561 # Generate new name from original template
562 $path = _replace_XX($template, $options{"suffixlen"});
570 ${$options{ErrStr}} = "Tried to get a new temp name different to the previous value $MAX_GUESS times.\nSomething wrong with template?? ($template)";
604 # Arguments: $template (the template with XXX),
607 # Returns: modified template
611 croak 'Usage: _replace_XX($template, $ignore)'
938 template is specified using the TEMPLATE option. The OPEN option
961 # template (store it in an error so that it will
963 my @template = ( exists $args{TEMPLATE} ? $args{TEMPLATE} : () );
970 my ($fh, $path) = tempfile( @template, %args );
1053 ($fh, $filename) = tempfile($template);
1056 template. Trailing `X' characters are replaced with random letters to
1058 at the end of the template.
1060 ($fh, $filename) = tempfile($template, SUFFIX => $suffix)
1062 Same as previously, except that a suffix is added to the template
1067 ($fh, $filename) = tempfile($template, DIR => $dir);
1069 Translates the template as before except that a directory name
1072 ($fh, $filename) = tempfile($template, UNLINK => 1);
1080 If the template is not specified, a template is always
1085 $fh = tempfile( $template, DIR => $dir );
1098 (undef, $filename) = tempfile($template, OPEN => 0);
1100 This will return the filename based on the template but
1126 my $template = (scalar(@_) % 2 == 1 ? shift(@_) : undef);
1145 # Construct the template
1148 # functions or simply constructing a template and using _gettemp()
1151 # First generate a template if not defined and prefix the directory
1152 # If no template must prefix the temp directory
1153 if (defined $template) {
1156 $template = File::Spec->catfile($options{"DIR"}, $template);
1164 $template = File::Spec->catfile($options{"DIR"}, TEMPXXX);
1168 $template = File::Spec->catfile(File::Spec->tmpdir, TEMPXXX);
1175 $template .= $options{"SUFFIX"};
1190 croak "Error in tempfile() using $template: $errstr"
1191 unless (($fh, $path) = _gettemp($template,
1238 $tempdir = tempdir( $template );
1240 Create a directory from the supplied template. This template is
1242 of the template are replaced with random letters to construct the
1243 directory name. At least four `X' characters must be in the template.
1248 The temporary directory name is derived from an internal template.
1250 $tempdir = tempdir ( $template, DIR => $dir );
1252 Prepend the supplied directory name to the template. The template
1254 directory specifications are removed from the template before
1257 $tempdir = tempdir ( $template, TMPDIR => 1 );
1259 Using the supplied template, create the temporary directory in
1262 $tempdir = tempdir ( $template, DIR => File::Spec->tmpdir);
1265 template itself. The C<TMPDIR> option is ignored if C<DIR> is set
1266 explicitly. Additionally, C<TMPDIR> is implied if neither a template
1269 $tempdir = tempdir( $template, CLEANUP => 1);
1271 Create a temporary directory using the supplied template, but
1277 Of course, if the template is not specified, the temporary directory
1293 "TMPDIR" => 0, # Use tempdir with template
1297 my $template = (scalar(@_) % 2 == 1 ? shift(@_) : undef );
1302 # Modify or generate the template
1305 if (defined $template) {
1313 $template = VMS::Filespec::vmspath($template) if $^O eq 'VMS';
1314 my ($volume, $directories, undef) = File::Spec->splitpath( $template, 1);
1316 # Last directory is then our template
1317 $template = (File::Spec->splitdir($directories))[-1];
1322 $template = File::Spec->catdir($options{"DIR"}, $template);
1327 $template = File::Spec->catdir(File::Spec->tmpdir, $template);
1337 $template = File::Spec->catdir($options{"DIR"}, TEMPXXX);
1341 $template = File::Spec->catdir(File::Spec->tmpdir, TEMPXXX);
1351 $template =~ m/([\.\]:>]+)$/;
1354 if ( ($^O eq 'MacOS') && (substr($template, -1) eq ':') ) {
1360 croak "Error in tempdir() using $template: $errstr"
1361 unless ((undef, $tempdir) = _gettemp($template,
1389 Given a template, returns a filehandle to the temporary file and the name
1392 ($fh, $name) = mkstemp( $template );
1396 The template may be any filename with some number of X's appended
1406 croak "Usage: mkstemp(template)"
1409 my $template = shift;
1412 croak "Error in mkstemp using $template: $errstr"
1413 unless (($fh, $path) = _gettemp($template,
1432 with a suffix to be appended to the template.
1434 ($fh, $name) = mkstemps( $template, $suffix );
1436 For example a template of C<testXXXXXX> and suffix of C<.dat>
1445 croak "Usage: mkstemps(template, suffix)"
1449 my $template = shift;
1452 $template .= $suffix;
1455 croak "Error in mkstemps using $template: $errstr"
1456 unless (($fh, $path) = _gettemp($template,
1473 Create a directory from a template. The template must end in
1476 $tmpdir_name = mkdtemp($template);
1489 croak "Usage: mkdtemp(template)"
1492 my $template = shift;
1495 $template =~ m/([\.\]:>]+)$/;
1498 if ( ($^O eq 'MacOS') && (substr($template, -1) eq ':') ) {
1503 croak "Error creating temp directory from template $template\: $errstr"
1504 unless (($junk, $tmpdir) = _gettemp($template,
1520 $unopened_file = mktemp($template);
1528 croak "Usage: mktemp(template)"
1531 my $template = shift;
1534 croak "Error getting name to temp file from template $template: $errstr"
1535 unless (($junk, $tmpname) = _gettemp($template,
1559 If this is a problem, simply use mkstemp() and specify a template.
1574 after constructing a suitable template.
1594 # Use a ten character template and append to tmpdir
1595 my $template = File::Spec->catfile($tmpdir, TEMPXXX);
1598 return mkstemp($template);
1600 return mktemp($template);
1673 my $template = File::Spec->catfile($dir, $prefix);
1675 return mktemp($template);