Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re^3: Temp file strategy

by blazar (Canon)
on Sep 19, 2005 at 09:59 UTC ( #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
Node Status?
node history
Node Type: note [id://493110]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (4)
As of 2019-10-19 06:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?