File::Slurp::Tiny(3)

πŸŽ€ NAME πŸŽ€

okay bestie, welcome to the File::Slurp::Tiny(3) manual page β€” this is the one from User Contributed Perl Documentation, and it’s literally called File::Slurp::Tiny 🫢. The official vibe is β€œA simple, sane and efficient file slurper [DISCOURAGED]” πŸ’…. Yes, that [DISCOURAGED] is part of the tagline, no cap.

🌈 VERSION 🌈

version 0.004 ✨

πŸ¦‹ SYNOPSIS πŸ¦‹

use File::Slurp::Tiny 'read_file';
my $content = read_file($filename);

That’s the whole little intro, bestie β€” import read_file and slurp a file into $content πŸ“.

🚨 DISCOURAGED 🚨

Okay so this is the important part: this module is discouraged in favor of File::Slurper πŸ’€. While it was a useful experiment, it turned out to be both too similar to File::Slurp β€” it still contains most problematic features of File::Slurp's interface β€” and yet not similar enough to be a true drop-in replacement 😭.

Bugs will still be fixed, but new features will probably not be added 🫢. So like, bug fixes are still on the table, but new features probably aren’t.

πŸ’œ DESCRIPTION πŸ’œ

This module provides functions for fast and correct slurping and spewing ✨. All functions are optionally exported πŸ‘‘

πŸ’… FUNCTIONS πŸ’…

🌸 read_file($filename, %options) 🌸

Reads file $filename into a scalar πŸ“–. By default it returns this scalar. Can optionally take these named arguments:

  • binmode β€” set the layers to read the file with. The default will be something sensible on your platform 🧚.
  • buf_ref β€” pass a reference to a scalar to read the file into, instead of returning it by value. This has performance benefits πŸ”₯.
  • scalar_ref β€” if set to true, read_file will return a reference to a scalar containing the file content πŸŽ€.

πŸ¦‹ read_lines($filename, %options) πŸ¦‹

Reads file $filename into a list/array πŸ“š. By default it returns this list. Can optionally take these named arguments:

  • binmode β€” set the layers to read the file with. The default will be something sensible on your platform 🌈.
  • array_ref β€” pass a reference to an array to read the lines into, instead of returning them by value. This has performance benefits ⭐.
  • chomp β€” chomp the lines βœ‚οΈ.

πŸ“ write_file($filename, $content, %options) πŸ“

Open $filename, and write $content to it ✍️. Can optionally take this named argument:

  • binmode β€” set the layers to write the file with. The default will be something sensible on your platform πŸ’–.

πŸ‘‘ 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 πŸ‘€
  • File::Slurp β€” Another file slurping tool πŸ₯€

πŸ’– AUTHOR πŸ’–

Leon Timmermans <leont@cpan.org> 🫢

This software is copyright (c) 2013 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.


and that’s the whole page, bestie β€” footer sign-off time: this manual page came from perl v5.40.2, dated 2023-07-03, and it’s the File::Slurp::Tiny(3) page πŸ’…βœ¨.

πŸ“¦ where this page comes from