NAME
File::Slurper - A simple, sane and efficient file slurper
VERSION
version 0.002
SYNOPSIS
use File::Slurper 'read_text';
my $content = read_text($filename);
DESCRIPTION
DISCLAIMER: this module is experimental, and may still change in non-compatible ways.
This module provides functions for fast and correct slurping and spewing. All functions are optionally exported.
FUNCTIONS
read_text($filename, $encoding, %options)
Reads file $filename
into a scalar and decodes it from $encoding
(which defaults to UTF-8). Can optionally take this named argument:
crlf
This forces crlf translation on the input. The default for this argument is platform specific.
read_binary($filename)
Reads file $filename
into a scalar without any decoding or transformation.
read_lines($filename, $encoding, %options)
Reads file $filename
into a list/array after decoding from $encoding
. By default it returns this list. Can optionally take this named argument:
chomp
chomp
the lines.
read_dir($dirname, %options)
Open dirname
and return all entries except .
and ..
. Can optionally take this named argument:
prefix
This will prepend
$dir
to the entries
TODO
Writer functions
open_text
?
SEE ALSO
-
A minimalistic abstraction not only around IO but also paths.
-
Another file slurping tool.
AUTHOR
Leon Timmermans <leont@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2014 by Leon Timmermans.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.