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

Re^3: Temp file strategy

by blazar (Canon)
on Sep 19, 2005 at 09:59 UTC ( [id://493110]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Temp file strategy
in thread Temp file strategy

Indeed. But it depends on the OS you're under: I'm not really sure, but I think that Windows doesn't support real anonymous files, so the temporary file that you can see should still be there somewhere.

Here I'm under Linux and I get

$ strace -e open perl -e 'open $f, "+>", undef' 2>&1 | tail -n 1 open("/tmp/PerlIO_vfNALU", O_RDWR|O_CREAT|O_EXCL|O_LARGEFILE, 0600) = +3
but of course it is soon deleted:
$ perl -le 'open $f, "+>", undef; print readlink "/proc/self/fd/" . fileno $f' /tmp/PerlIO_vJg2Uf (deleted)
(or
$ perl -le 'open $f, "+>", undef; print readlink "/proc/self/fd/" . fileno $f' /tmp/.nfs0004821b00000353
if run on a machine where /tmp is mounted under nfs.)

Whatever, all this is at best fragile and tricky. This interesting open feature is best suited for a file to write stuff into, to recover it later. For your application any of the other suggestions you got would be probably preferable.

I just mentioned this temp file strategy option because IMHO it would deserve to be better known.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (2)
As of 2025-06-22 17:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.