The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

File::Slurp::Sane - A simple, sane and efficient file slurper

VERSION

version 0.001

SYNOPSIS

 use File::Slurp::Sane '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

SEE ALSO

  • Path::Tiny

    A minimalistic abstraction not only around IO but also paths.

  • File::Slurp

    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.