GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  FILE::SLURPER (3)

.ds Aq ’

NAME

File::Slurper - A simple, sane and efficient module to slurp a file

CONTENTS

VERSION

version 0.008

SYNOPSIS



 use File::Slurper read_text;
 my $content = read_text($filename);



DESCRIPTION

This module provides functions for fast and correct slurping and spewing. All functions are optionally exported.

FUNCTIONS

read_text($filename, CW$encoding, CW$crlf)

Reads file $filename into a scalar and decodes it from $encoding (which defaults to UTF-8). If $crlf is true, crlf translation is performed. The default for this argument is off. The special value auto will set it to a platform specific default value.

    read_binary($filename)

Reads file $filename into a scalar without any decoding or transformation.

read_lines($filename, CW$encoding, CW$crlf, CW$skip_chomp)

Reads file $filename into a list/array line-by-line, after decoding from $encoding, optional crlf translation and chomping.

write_text($filename, CW$content, CW$encoding, CW$crlf)

Writes $content to file $filename, encoding it to $encoding (which defaults to UTF-8). It can also take a crlf argument that works exactly as in read_text.

write_binary($filename, CW$content)

Writes $content to file $filename as binary data.

    read_dir($dirname)

Open dirname and return all entries except . and ...

RATIONALE

This module tries to make it as easy as possible to read and write files correctly and fast. The most correct way of doing this is not always obvious (e.g. #83126 <https://rt.cpan.org/Public/Bug/Display.html?id=83126>), and just as often the most obvious correct way is not the fastest correct way. This module hides away all such complications behind an easy intuitive interface.

DEPENDENCIES

This module has an optional dependency on PerlIO::utf8_strict. Installing this will make UTF-8 encoded IO significantly faster, but should not otherwise affect the operation of this module. This may change into a dependency on the related Unicode::UTF8 in the future.

SEE ALSO

o Path::Tiny

A minimalistic abstraction handling not only IO but also paths.

o IO::All

An attempt to expose as many IO related features as possible via a single API.

o File::Slurp

This is previous generation file slurping module. It has a number of issues, as described here <http://blogs.perl.org/users/leon_timmermans/2015/08/fileslurp-is-broken-and-wrong.html>

o File::Slurp::Tiny

This was my previous attempt at a better file slurping module. It’s mostly (but not entirely) a drop-in replacement for File::Slurp, which is both a feature (easy conversion) and a bug (interface issues).

TODO

o open_text/open_binary?
o drain_handle?

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.

Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 FILE::SLURPER (3) 2015-08-31

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.