Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Temporary file management in Perl -- is it possible?

by kennethk (Monsignor)
on Apr 24, 2013 at 20:23 UTC ( #1030517=note: print w/ replies, xml ) Need Help??


in reply to Temporary file management in Perl -- is it possible?

I'd say a cron job that removes files older than 10 minutes is in general cleaner, but one possibility would be fork and wait 10 minutes, a la:

if (!fork) { sleep 600; unlink "$gmtstring-$filehandle"; exit; }

Of course, for production, you'll want to test to make sure fork returns defined, probably set $SIG{CHLD}='IGNORE' (see perlipc) and a couple other clean-ups.


#11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.


Comment on Re: Temporary file management in Perl -- is it possible?
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1030517]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (5)
As of 2014-12-21 19:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (107 votes), past polls