File-Takeput
view release on metacpan or search on metacpan
README.html view on Meta::CPAN
# Write content back to the first file after editing it.
# The locks will be released right afterwards.
$content1[$_] =~ s/,/;/g for (0..$#content1);
put('some_file_name.csv')->(@content1);</code></pre>
<h1 id="DESCRIPTION">DESCRIPTION</h1>
<p>Slurp style file IO with locking. The purpose of Takeput is to make it pleasant for you to script file IO. Slurp style is both user friendly and very effective if you can have your files in memory.</p>
<p>The other major point of Takeput is locking. Takeput is careful to help your script be a good citizen in a busy filesystem. All its file operations respect and set flock locking.</p>
<p>If your script misses a lock and does not release it, the lock will be released when your script terminates.</p>
<p>Encoding is often part of file IO operations, but Takeput keeps out of that. It reads and writes file content just as strings of bytes, in a sort of line-based binmode. Use some other module if you need decoding and encoding. For example:</p>
<pre><code> use File::Takeput;
use Encode;
my @article = map {decode('iso-8859-1',$_)} grab 'article.latin-1';</code></pre>
# Write content back to the first file after editing it.
# The locks will be released right afterwards.
$content1[$_] =~ s/,/;/g for (0..$#content1);
put('some_file_name.csv')->(@content1);
# DESCRIPTION
Slurp style file IO with locking. The purpose of Takeput is to make it pleasant for you to script file IO. Slurp style is both user friendly and very effective if you can have your files in memory.
The other major point of Takeput is locking. Takeput is careful to help your script be a good citizen in a busy filesystem. All its file operations respect and set flock locking.
If your script misses a lock and does not release it, the lock will be released when your script terminates.
Encoding is often part of file IO operations, but Takeput keeps out of that. It reads and writes file content just as strings of bytes, in a sort of line-based binmode. Use some other module if you need decoding and encoding. For example:
use File::Takeput;
use Encode;
my @article = map {decode('iso-8859-1',$_)} grab 'article.latin-1';
lib/File/Takeput.pm view on Meta::CPAN
# Write content back to the first file after editing it.
# The locks will be released right afterwards.
$content1[$_] =~ s/,/;/g for (0..$#content1);
put('some_file_name.csv')->(@content1);
=head1 DESCRIPTION
Slurp style file IO with locking. The purpose of Takeput is to make it pleasant for you to script file IO. Slurp style is both user friendly and very effective if you can have your files in memory.
The other major point of Takeput is locking. Takeput is careful to help your script be a good citizen in a busy filesystem. All its file operations respect and set flock locking.
If your script misses a lock and does not release it, the lock will be released when your script terminates.
Encoding is often part of file IO operations, but Takeput keeps out of that. It reads and writes file content just as strings of bytes, in a sort of line-based binmode. Use some other module if you need decoding and encoding. For example:
use File::Takeput;
use Encode;
my @article = map {decode('iso-8859-1',$_)} grab 'article.latin-1';
( run in 0.285 second using v1.01-cache-2.11-cpan-87723dcf8b7 )