cleanup#
Remove every temp file and directory currently registered for cleanup, immediately, and return 1.
Synopsis#
File::Temp::cleanup();
What you get back#
The integer 1. The call drains the internal cleanup registry,
so anything tagged UNLINK => 1 or CLEANUP => 1 is removed in
the reverse order it was registered.
Examples#
use File::Temp;
my $dir = File::Temp::tempdir(CLEANUP => 1);
## ...
File::Temp::cleanup(); # remove $dir now
Edge cases#
An implicit call is made automatically at interpreter exit via the
ENDqueue, so manual invocation is rarely needed.Entries not flagged for cleanup are skipped.
Differences from upstream#
Fully compatible with upstream File::Temp 0.2312.
See also#
unlink_on_destroy— toggle cleanup tracking on a single object.unlink0/unlink1— targeted file removal used by tempfile internals.