Re: I am getting flooded with tmp files

[email protected] (ToddAndMargo via perl6-users)
Newsgroups perl.perl6.users
Message-ID <[email protected]>
On 11/18/24 20:06, ToddAndMargo via perl6-users wrote:
> I am getting flooded with tmp files.  I though
> I was erasing them (unlink).  What am I doing
> wrong:
> 
> use File::Temp;
> ...
> my Str $TmpFile = $?FILE;
> $TmpFile ~~ s| .* $( Q[/] ) ||;  # we need just the name
> $TmpFile ~~ s| $( Q[.] ) .* ||;
> 
> ($TmpFile, $TmpHandle) = tempfile(:tempdir("."), $TmpFile ~ "_******" ~ 
> ".tmp" );
> ...
> ($TmpFile, $TmpHandle) = tempfile(:tempdir("."), :!unlink);
> 


It seems that all my tmp files are being removed
when my program exits normally.  It was crashing
until I fix a problem.

But why wait till the program exits when I tell
it to unlink before that?
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.