File::Slurper - Online Linux Manual PageSection : 3
Updated : 2022-01-21
Source : perl v5.34.0
Note : User Contributed Perl Documentation

NAMEFile::Slurper − A simple, sane and efficient module to slurp a file

VERSIONversion 0.013

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

DESCRIPTIONThis module provides functions for fast and correct slurping and spewing. All functions are optionally exported. All functions throw exceptions on errors, write functions don't return any meaningful value.

FUNCTIONS

read_text($filename, $encoding, $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, $encoding, $crlf, $skip_chomp)Reads file $filename into a list/array line-by-line, after decoding from $encoding, optional crlf translation and chomping. It will always use newline as separator.

write_text($filename, $content, $encoding, $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, $content)Writes $content to file $filename as binary data.

read_dir($dirname)Open dirname and return all entries except . and ...

RATIONALEThis 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.

DEPENDENCIESThis 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• Path::Tiny A minimalistic abstraction handling not only IO but also paths. • IO::All An attempt to expose as many IO related features as possible via a single API. • File::Slurp This is a 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>. • 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• open_text/open_binary? • drain_handle?

AUTHORLeon Timmermans <leont@cpan.org>

COPYRIGHT AND LICENSEThis 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.
0
Johanes Gumabo
Data Size   :   13,137 byte
man-File::Slurper.3pmBuild   :   2024-12-05, 20:55   :  
Visitor Screen   :   x
Visitor Counter ( page / site )   :   4 / 168,586
Visitor ID   :     :  
Visitor IP   :   13.59.58.68   :  
Visitor Provider   :   AMAZON-02   :  
Provider Position ( lat x lon )   :   39.962500 x -83.006100   :   x
Provider Accuracy Radius ( km )   :   1000   :  
Provider City   :   Columbus   :  
Provider Province   :   Ohio ,   :   ,
Provider Country   :   United States   :  
Provider Continent   :   North America   :  
Visitor Recorder   :   Version   :  
Visitor Recorder   :   Library   :  
Online Linux Manual Page   :   Version   :   Online Linux Manual Page - Fedora.40 - march=x86-64 - mtune=generic - 24.12.05
Online Linux Manual Page   :   Library   :   lib_c - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Online Linux Manual Page   :   Library   :   lib_m - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Data Base   :   Version   :   Online Linux Manual Page Database - 24.04.13 - march=x86-64 - mtune=generic - fedora-38
Data Base   :   Library   :   lib_c - 23.02.07 - march=x86-64 - mtune=generic - fedora.36

Very long time ago, I have the best tutor, Wenzel Svojanovsky . If someone knows the email address of Wenzel Svojanovsky , please send an email to johanes_gumabo@yahoo.co.id .
If error, please print screen and send to johanes_gumabo@yahoo.co.id
Under development. Support me via PayPal.

ERROR : Need New Coding :         (parse_manual_page_|249|File::Slurper.3pm|36/37|el══─{─══.|.el══─{─══. ds -- \|\(em\| )         (htmlprn|149|File::Slurper.3pm|36/37|.el══─{─══. ds --  —  |.el══─{─══. ds -- \|\(em\| )         (parse_manual_page_|249|File::Slurper.3pm|43|br══─}─══|'br══─}─══ )         (htmlprn|149|File::Slurper.3pm|43|'br══─}─══ |'br══─}─══ )