NAME

Fsdb::Support::NamedTmpfile - dreate temporary files that can be opened

SYNOPSIS

    use Fsdb::Support::NamedTmpfile;
    $pathname = Fsdb::Support::NamedTmpfile::alloc($tmpdir);

FUNCTIONS

alloc

    $pathname = Fsdb::Support::NamedTmpfile::alloc($tmpdir);

Create a unique filename for temporary data. $TMPDIR is optional. The file is automatically removed on program exit, but the pathname exists for the duration of execution (and can be opened).

Note that there is a potential race condition between when we pick the file and when the caller opens it, when an external program could intercede. The caller therefor should open files with exclusive access.

This routine is Perl thread-safe, and process fork safe. (Files are only cleaned up by the process that creates them.)

While this routine is basically "new", we don't call it such because we do not return an object.

cleanup_one

    Fsdb::Support::NamedTmpfile::cleanup_one('some_filename');

cleanup one tmpfile, forgetting about it if necessary.

cleanup_all

    Fsdb::Support::NamedTmpfile::cleanup_all

Cleanup all tmpfiles Not a method.