I am forking in a perl script and exiting from parent process after
my ( $S_TEMP_FILE, $stmpfile ) = tempfile( UNLINK => 1, DIR => $TMPDIR );
Files created by
tempfile are "automatically removed when the program exits", not when some subroutine exits.
Note that if the program calls
_exit or if it's killed by a signal, the program won't get a chance to delete these files.
If you want the file to be deleted sooner, you'll need to delete it yourself or use
File::Temp->new() instead of
tempfile. (Files created by
File::Temp->new() are be deleted when the object is destroyed.)