unlink0#
Remove a temporary file while its filehandle is still open.
תקציר#
unlink0($fh, $path) or die "unlink0: $!";
מה מוחזר#
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.
דוגמאות#
use File::Temp qw/ tempfile unlink0 /;
my ($fh, $path) = tempfile();
unlink0($fh, $path);
## $path is gone, but $fh is still usable
מקרי קצה#
If
$File::Temp::KEEP_ALLis true the function returns1without unlinking.Fewer than two arguments: no-op, returns
1.
הבדלים מן ה-upstream#
Upstream performs a full
stat/fstatcomparison 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 byt/81-xs-native/File-Temp/*.t.
ראו גם#
unlink1- close-then-unlink variant.cmpstat- the stat comparison used by upstreamunlink0.tempfile- uses this internally in scalar context.