1File::Slurp::Tiny(3) User Contributed Perl Documentation File::Slurp::Tiny(3)
2
3
4
6 File::Slurp::Tiny - A simple, sane and efficient file slurper
7 [DISCOURAGED]
8
10 version 0.004
11
13 use File::Slurp::Tiny 'read_file';
14 my $content = read_file($filename);
15
17 This module is discouraged in favor of File::Slurper. While a useful
18 experiment, it turned out to be both too similar to File::Slurp (still
19 containing most problematic features of File::Slurp's interface) and
20 yet not similar enough to be a true drop-in replacement.
21
22 Bugs will still be fixed, but new features will probably not be added.
23
25 This module provides functions for fast and correct slurping and
26 spewing. All functions are optionally exported.
27
29 read_file($filename, %options)
30 Reads file $filename into a scalar. By default it returns this scalar.
31 Can optionally take these named arguments:
32
33 • binmode
34
35 Set the layers to read the file with. The default will be something
36 sensible on your platform.
37
38 • buf_ref
39
40 Pass a reference to a scalar to read the file into, instead of
41 returning it by value. This has performance benefits.
42
43 • scalar_ref
44
45 If set to true, "read_file" will return a reference to a scalar
46 containing the file content.
47
48 read_lines($filename, %options)
49 Reads file $filename into a list/array. By default it returns this
50 list. Can optionally take these named arguments:
51
52 • binmode
53
54 Set the layers to read the file with. The default will be something
55 sensible on your platform.
56
57 • array_ref
58
59 Pass a reference to an array to read the lines into, instead of
60 returning them by value. This has performance benefits.
61
62 • chomp
63
64 "chomp" the lines.
65
66 write_file($filename, $content, %options)
67 Open $filename, and write $content to it. Can optionally take this
68 named argument:
69
70 • binmode
71
72 Set the layers to write the file with. The default will be
73 something sensible on your platform.
74
75 read_dir($dirname, %options)
76 Open "dirname" and return all entries except "." and "..". Can
77 optionally take this named argument:
78
79 • prefix
80
81 This will prepend $dir to the entries
82
84 • Path::Tiny
85
86 A minimalistic abstraction not only around
87
88 • File::Slurp
89
90 Another file slurping tool.
91
93 Leon Timmermans <leont@cpan.org>
94
96 This software is copyright (c) 2013 by Leon Timmermans.
97
98 This is free software; you can redistribute it and/or modify it under
99 the same terms as the Perl 5 programming language system itself.
100
101
102
103perl v5.32.1 2021-01-27 File::Slurp::Tiny(3)