```{index} single: dir_destroy; File::Temp function ``` ```{index} single: File::Temp::dir_destroy; Perl function ``` # dir_destroy Destructor for `File::Temp::Dir` objects — removes the directory tree when `CLEANUP` is true, the current pid matches the creator, and `$File::Temp::KEEP_ALL` is false. ## Synopsis ```perl { my $dir = File::Temp->newdir; # CLEANUP => 1 by default } # DESTROY runs here; tree is removed ``` ## What you get back Nothing — invoked by the runtime when the last reference drops. ## Edge cases - A child process that inherits the object does not remove the directory on exit; only the creator pid does. - `$File::Temp::KEEP_ALL = 1` suppresses removal. ## 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.