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

Yet Another new slurp module

Thread Previous | Thread Next
From:
david nicol
Date:
October 26, 2003 21:15
Subject:
Yet Another new slurp module
Message ID:
1067231690.1071.58.camel@plaza.davidnicol.com
On Thu, 2003-10-23 at 05:35, Dave Mitchell wrote:

>. I've always
> found it annoying that Perl, which is famously used for manipulating files
> and their contents, doesn't have an easy way of just grabbing or writing a
> whole file at time.
> 
> And I'd expect to find it under File::.


but it is now under Tie::

Tie::Slurp has just been uploaded to CPAN.

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

Is that going to be safe and portable?




-- 
david nicol / A thousand towers rise before me and I cannot climb them all.


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