.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "File::Slurp::Tiny 3pm" .TH File::Slurp::Tiny 3pm "2022-12-06" "perl v5.36.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" File::Slurp::Tiny \- A simple, sane and efficient file slurper [DISCOURAGED] .SH "VERSION" .IX Header "VERSION" version 0.004 .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 2 \& use File::Slurp::Tiny \*(Aqread_file\*(Aq; \& my $content = read_file($filename); .Ve .SH "DISCOURAGED" .IX Header "DISCOURAGED" \&\fBThis module is discouraged in favor of File::Slurper\fR. While a useful experiment, it turned out to be both too similar to File::Slurp (still containing most problematic features of File::Slurp's interface) and yet not similar enough to be a true drop-in replacement. .PP Bugs will still be fixed, but new features will probably not be added. .SH "DESCRIPTION" .IX Header "DESCRIPTION" This module provides functions for fast and correct slurping and spewing. All functions are optionally exported. .SH "FUNCTIONS" .IX Header "FUNCTIONS" .ie n .SS "read_file($filename, %options)" .el .SS "read_file($filename, \f(CW%options\fP)" .IX Subsection "read_file($filename, %options)" Reads file \f(CW$filename\fR into a scalar. By default it returns this scalar. Can optionally take these named arguments: .IP "\(bu" 4 binmode .Sp Set the layers to read the file with. The default will be something sensible on your platform. .IP "\(bu" 4 buf_ref .Sp Pass a reference to a scalar to read the file into, instead of returning it by value. This has performance benefits. .IP "\(bu" 4 scalar_ref .Sp If set to true, \f(CW\*(C`read_file\*(C'\fR will return a reference to a scalar containing the file content. .ie n .SS "read_lines($filename, %options)" .el .SS "read_lines($filename, \f(CW%options\fP)" .IX Subsection "read_lines($filename, %options)" Reads file \f(CW$filename\fR into a list/array. By default it returns this list. Can optionally take these named arguments: .IP "\(bu" 4 binmode .Sp Set the layers to read the file with. The default will be something sensible on your platform. .IP "\(bu" 4 array_ref .Sp Pass a reference to an array to read the lines into, instead of returning them by value. This has performance benefits. .IP "\(bu" 4 chomp .Sp \&\f(CW\*(C`chomp\*(C'\fR the lines. .ie n .SS "write_file($filename, $content, %options)" .el .SS "write_file($filename, \f(CW$content\fP, \f(CW%options\fP)" .IX Subsection "write_file($filename, $content, %options)" Open \f(CW$filename\fR, and write \f(CW$content\fR to it. Can optionally take this named argument: .IP "\(bu" 4 binmode .Sp Set the layers to write the file with. The default will be something sensible on your platform. .ie n .SS "read_dir($dirname, %options)" .el .SS "read_dir($dirname, \f(CW%options\fP)" .IX Subsection "read_dir($dirname, %options)" Open \f(CW\*(C`dirname\*(C'\fR and return all entries except \f(CW\*(C`.\*(C'\fR and \f(CW\*(C`..\*(C'\fR. Can optionally take this named argument: .IP "\(bu" 4 prefix .Sp This will prepend \f(CW$dir\fR to the entries .SH "SEE ALSO" .IX Header "SEE ALSO" .IP "\(bu" 4 Path::Tiny .Sp A minimalistic abstraction not only around .IP "\(bu" 4 File::Slurp .Sp Another file slurping tool. .SH "AUTHOR" .IX Header "AUTHOR" Leon Timmermans .SH "COPYRIGHT AND LICENSE" .IX Header "COPYRIGHT AND LICENSE" This software is copyright (c) 2013 by Leon Timmermans. .PP This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.