develooper Front page | perl.perl5.porters | Postings from October 2003

Re: Yet Another new slurp module

Thread Previous | Thread Next
From:
Uri Guttman
Date:
October 26, 2003 21:22
Subject:
Re: Yet Another new slurp module
Message ID:
x7d6cj45m7.fsf@mail.sysarch.com
>>>>> "dn" == david nicol <whatever@davidnicol.com> writes:

  >> And I'd expect to find it under File::.

  dn> but it is now under Tie::

  dn> Tie::Slurp has just been uploaded to CPAN.

  dn> Tie::Slurp uses the __advisory__ nature of Flock locking to prevent
  dn> slurping a freshly truncated file put there by another process, by
  dn> opening the file, locking it exclusively, then opening it again in
  dn> truncate mode, and writing to the second handle, closing the second
  dn> handle, unlocking, then closing the first handle.

this would be trivial to add to my module as it has the options
interface. but i would use a mkdir lock wrapper instead.

also my write_file does an overwrite and does not truncate (to its real
size) until after the file is written. if the file is short enough, then
the write will likely be atomic anyway.

  dn> Is that going to be safe and portable?

i won't get into a lock and portability war :)

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs  ----------------------------  http://jobs.perl.org

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About