Fsdb::Support::NamedTmpfile - dreate temporary files that can be opened
use Fsdb::Support::NamedTmpfile; $pathname = Fsdb::Support::NamedTmpfile::alloc($tmpdir);
$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.
Fsdb::Support::NamedTmpfile::cleanup_one('some_filename');
cleanup one tmpfile, forgetting about it if necessary.
Fsdb::Support::NamedTmpfile::cleanup_all
Cleanup all tmpfiles Not a method.
To install Fsdb, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Fsdb
CPAN shell
perl -MCPAN -e shell install Fsdb
For more information on module installation, please visit the detailed CPAN module installation guide.