Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??

We teach binmode, for use when we expect the file to be binary. If there were a layer I could pass to binmode which turned off binary, or turned everything back to text processing (text/reset/default/native) which didn't require another module to do it, I'd be thrilled. Unfortunately this doesn't seem to be the case.

I don't mind teaching my students that File::Temp assumes that temporary files will be binary by default. I was just hoping that someone could show me the easy, portable way we could revert that. But it doesn't seem to exist in Perl 5.10 and below. Perhaps I'll get a patch into File::Temp for 5.10.1, or alternately have some luck getting a layer for binmode which turns off binary.

Unfortunately in-memory files isn't really what I was looking for. They're cool, but they don't really solve the problem I was having. I want to be able to write out a file to a temporary location, then when I know that it's been fully written, I want to move the file over an original atomically. This means that at no point can someone access that file and get invalid data. Old previously-valid data, sure, but never only partly-written data.

thanks, jarich.


In reply to Re^3: Temporary text files with File::Temp by jarich
in thread Temporary text files with File::Temp by jarich

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!
  • 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, 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, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            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.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others romping around the Monastery: (9)
    As of 2014-09-03 03:04 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      My favorite cookbook is:










      Results (35 votes), past polls