Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Using Temporary Files in Perl

by ask (Pilgrim)
on Dec 01, 2001 at 21:26 UTC ( #128885=note: print w/ replies, xml ) Need Help??


in reply to Using Temporary Files in Perl

The problems with temporary filenames comes from using a shared directory (/tmp).

When I do not use File::Temp (or something similar) I usually just create the temporary files in ~/tmp/, ~/.application_name/tmp/ or something like that.

 - ask

-- 
ask bjoern hansen, http://ask.netcetera.dk/   !try; do();


Comment on Re: Using Temporary Files in Perl
Re: Re: Using Temporary Files in Perl
by rob_au (Abbot) on Dec 01, 2001 at 21:48 UTC
    Hrmmm, while your approach has merit, it doesn't really address the dogma that surrounds the more general issue of usage of temporary files in Perl - The movement of application temporary file generation into (presumably) owner-only writable directories makes a number of assumptions about the application platform:

    • The platform supports multiple users and path expansion of the tilde into home user directories,

    • The platform honours sticky-directory permissions so that the created temporary file remains accessible with permissions of the users home directory

    Additionally, the use of function library calls for common tasks such as temporary file creation and utilisation offer greater cross-platform portability for applications with the differences in platform structure implemented within the library rather than the application code.

     

    perl -e 's&&rob@cowsnet.com.au&&&split/[@.]/&&s&.com.&_&&&print'

      While you are right about the cross platform considerations, I don't understand this:

      The platform honours sticky-directory permissions so that the created temporary file remains accessible with permissions of the users home directory

      ?! Accessible to who? In general you really only want the user creating the file to have access to the temporary file. That's one of the problems with /tmp in the first place.

       - ask

      -- 
      ask bjoern hansen, http://ask.netcetera.dk/   !try; do();
      
Re: Re: Using Temporary Files in Perl
by belg4mit (Prior) on Dec 01, 2001 at 23:42 UTC
    Something to keep in mind is that this may cause problems if the user has a small quota as well. Wheras the only limitation for writing to /tmp is available disk space &| and any applicable hard fsize.

    --
    perl -p -e "s/(?:\w);([st])/'\$1/mg"

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (4)
As of 2014-07-23 04:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (133 votes), past polls