destroy#

Destructor for File::Temp objects — removes the underlying file when UNLINK is set and $File::Temp::KEEP_ALL is false.

Synopsis#

{
    my $tmp = File::Temp->new;  # UNLINK => 1 by default
}  # DESTROY runs here; file is unlinked

What you get back#

Nothing — this is a destructor invoked by the runtime when the last reference drops. It is rare to call it directly.

Edge cases#

  • $File::Temp::KEEP_ALL = 1 suppresses all file removal.

  • Files not registered with cleanup tracking are left on disk.

Differences from upstream#

Fully compatible with upstream File::Temp 0.2312.

See also#

  • unlink_on_destroy — per-object opt-out for the removal behavior.

  • cleanup — explicit cleanup of all registered temp entries.