As a general rule, modules should not be automatically employed just because they are there. (Update: In this case systems are usually just too individual - they have different process behaviour, disk space issues, support requirements etc.) If a task is simple enough, it is usually less work to do it yourself. In every system I ever worked on, unique temporary filenames were always generated using site-written rather than CPAN modules. In the current case we are satisfied to construct unique temporary filenames from a functional identifier plus the date and time plus the pid ($$ in perl) plus a file type with a dot separator between these elements, e.g.

NamedProcess.20051129.110401.1234.ext

Millions of systems the world over have used this type of method (first mainly in C and now also in Perl) for decades and it can safely be called a de facto standard to do so. By comparison, using a CPAN module makes your system less supportable and maintainable. Note also that most systems will need their own date and time formatting to match the above formats anyway and this reduces the unique tmpfile subroutine to a trivial one-liner:

return join( '.', shift(), ProjectDate(), ProjectTime(), $$, shift +() );

-M

Free your mind


In reply to Re: File::Temp randomness when forking by Moron
in thread File::Temp randomness when forking by ryantate

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.