Rand Stats

File::Temp

zef:raku-community-modules

Actions Status Actions Status Actions Status

NAME

File::Temp - Create temporary files & directories

SYNOPSIS

# Generate a temp dir
my $tmpdir = tempdir;

# Generate a temp file in a temp dir
my ($filename, $filehandle) = tempfile;

# specify a template for the filename
#  * are replaced with random characters
my ($filename, $filehandle) = tempfile("******");

# Automatically unlink files at end of program (this is the default)
my ($filename, $filehandle) = tempfile("******", :unlink);

# Specify the directory where the tempfile will be created
my ($filename, $filehandle) = tempfile(:tempdir("/path/to/my/dir"));

# don't unlink this one
my ($filename, $filehandle) = tempfile(:tempdir('.'), :!unlink);

# specify a prefix and suffix for the filename
my ($filename, $filehandle) = tempfile(:prefix('foo'), :suffix(".txt"));

DESCRIPTION

This module exports two routines:

AUTHORS

COPYRIGHT AND LICENSE

Copyright 2012 - 2017 Jonathan Scott Duff

Copyright 2018 - 2021 Rod Taylor

Copyright 2022 - 2024 Raku Community

This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0.