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

Re: Yet Another new slurp module

Thread Previous | Thread Next
Uri Guttman
October 26, 2003 21:22
Re: Yet Another new slurp module
Message ID:
>>>>> "dn" == david nicol <> 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 Guttman  ------  --------
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs  ----------------------------

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About