man Arch::TempFiles () - help to manage temporary files/dirs

NAME

Arch::TempFiles - help to manage temporary files/dirs

SYNOPSIS

    use Arch::TempFiles qw(temp_file_name temp_file temp_dir);
    # all will be removed automatically on the script completion
    my $file_name1 = temp_file();
    my $file_name2 = temp_file_name("status");
    my $dir_name = temp_dir("arch-tree");

    use Arch::TempFiles;
    my $tmp = new Arch::TempFiles;
    $tmp->root($tmp->dir);
    my $file_name = $tmp->name;
    open OUT, ">$file_name";
    close OUT;

DESCRIPTION

This module deals with temporary file names. It is similar to File::Temp, but simplier and more focused. Also, File::Temp is relatively new and was not shipped with older perl versions.

Both function interface and object oriented interface are supported.

FUNCTIONS/METHODS

The following functions are available:

temp_root, temp_name, temp_file_name, temp_dir_name, temp_file, temp_dir.

The corresponding class methods are available too:

root, name, file_name, dir_name, file, dir.

temp_root [dir]
$tmp->root [dir]
Change or return the root of the temporary files and dirs. The default is either CW$ENV{TMP_DIR} or /tmp.
temp_name [label]
$tmp->name [label]
Return the unused temporary file name. The default file name is /tmp/,,arch-XXXXXX where XXXXXX is a random number. To change this name use CWtemp_root and/or provide label that replaces arch. Please note, that the operation of acquiring the file name using this function/method and actual creating of this file is not atomic. So you may need to call this method again if the creation is failed, for example if some other process created the same file in the middle.
temp_file_name [label]
$tmp->file_name [label]
Like CWtemp_name, but stores the name in the file list that will be removed on the end (on object destruction).
temp_dir_name [label]
$tmp->dir_name [label]
Like CWtemp_name, but stores the name in the dir list that will be removed on the end (on object destruction).
temp_file [label]
$tmp->file [label]
Like CWtemp_file_name, but also creates the file.
temp_dir [label]
$tmp->dir [label]
Like CWtemp_dir_name, but also creates the dir.

BUGS

Awaiting for your reports.

AUTHORS

Mikhael Goikhman (migo@homemail.comPerl-GPL/arch-perldevel).

SEE ALSO

For a different interface, see File::Temp.