```{index} single: unlink0; File::Temp function ``` ```{index} single: File::Temp::unlink0; Perl function ``` # unlink0 Remove a temporary file while its filehandle is still open. ## Synopsis ```perl unlink0($fh, $path) or die "unlink0: $!"; ``` ## What you get back Integer `1` on success. The directory entry is removed; reads and writes on `$fh` continue to work, and the blocks are released when `$fh` is finally closed. ## Examples ```perl use File::Temp qw/ tempfile unlink0 /; my ($fh, $path) = tempfile(); unlink0($fh, $path); ## $path is gone, but $fh is still usable ``` ## Edge cases - If `$File::Temp::KEEP_ALL` is true the function returns `1` without unlinking. - Fewer than two arguments: no-op, returns `1`. ## Differences from upstream - Upstream performs a full `stat`/`fstat` comparison before unlinking to detect races and symlink tricks. This implementation unlinks by path without that check. Callers who need the stat-equality guarantee should validate the handle themselves. Covered by `t/81-xs-native/File-Temp/*.t`. ## See also - `unlink1` — close-then-unlink variant. - `cmpstat` — the stat comparison used by upstream `unlink0`. - `tempfile` — uses this internally in scalar context.