```{index} single: dir_unlink_on_destroy; File::Temp function ``` ```{index} single: File::Temp::dir_unlink_on_destroy; Perl function ``` # dir_unlink_on_destroy Toggle or query whether a `File::Temp::Dir` object removes its directory tree on destruction. ## Synopsis ```perl my $flag = $dir->unlink_on_destroy; # getter $dir->unlink_on_destroy(0); # keep the tree ``` ## What you get back The new (or current) cleanup flag as an integer. ## Examples ```perl my $dir = File::Temp->newdir; $dir->unlink_on_destroy(0); ## $dir's path survives after $dir goes out of scope ``` ## Edge cases - Called on something that is not a `File::Temp::Dir`: returns `0`. - Writes to the object's `CLEANUP` hash slot; reads by other code see the updated value. ## Differences from upstream Fully compatible with upstream `File::Temp` 0.2312. ## See also - `File::Temp->newdir` — constructor whose default is `CLEANUP => 1`. - `cleanup` — force-drain all registered cleanups now.