File::...nPolicy(3pm)
π NAME π
File::Slurp::WithinPolicy β bestie, this is the module that puts your filesystem policies on File::Slurp. Like, it's File::Slurp but with a bouncer at the door. π«Ά
(also hi, this is the page from the File::...nPolicy(3pm) manual, we're just vibing in here now)
β¨ SYNOPSIS β¨
okay so here's the whole vibe, copy-paste ready, no cap:
use File::Slurp::WithinPolicy qw(:all);
my $text = read_file( 'filename' );
my @lines = read_file( 'filename' );
write_file( 'filename', $text );
append_file( 'filename', $more_text );
overwrite_file( 'filename', $text );
my @files = read_dir( '/path/to/dir' );
look at that. it's giving "I just read a whole file into a scalar and I'm not even sorry". π
πΈ DESCRIPTION πΈ
So basically π this module hands you the whole File::Slurp interface, but everything happens inside a policy that gets defined by File::Policy. Think of it as File::Slurp but the sysadmin gets a say in the group chat.
And here's the thing, bestie β by default, File::Policy is a complete no-op, which means this module behaves exactly the same as File::Slurp. Identical. Zero notes. Fr fr.
But π system administrators might wanna override that default File::Policy implementation to enforce their own local filesystem policy. If that's a thing you need, go peek at File::Policy (linked down in SEE ALSO, iykyk).
π FUNCTIONS π
read_dir
See "read_dir" in File::Slurp
read_file
See "read_file" in File::Slurp
write_file
See "write_file" in File::Slurp
append_file
See "append_file" in File::Slurp
overwrite_file
See "overwrite_file" in File::Slurp
lowkey the whole point: every single one of these is documented over in File::Slurp. This module doesn't rewrite the lore, it just adds the policy layer on top. Go read the original, babe. π
π EXPORTS π
By default? nothing gets exported. Not a single thing. Empty-handed. π
But you can use the :all tag to export absolutely everything, if you're feeling generous with your namespace.
You can also export individual methods one at a time, if you're the type who picks and chooses. main character energy, honestly. π
π¦ SEE ALSO π¦
- File::Slurp
- File::Policy
β VERSION β
$Revision: 1.4 $ on $Date: 2005/06/15 10:40:21 $ by $Author: simonf $
(the SVN keywords are just sitting there unexpanded and honestly? iconic. we love a literal string. π)
π AUTHOR π
John Alden <cpan _at_ bbc _dot_ co _dot_ uk>
π COPYRIGHT π
(c) BBC 2005. This program is free software; you can redistribute it and/or modify it under the GNU GPL.
See the file COPYING in this distribution, or http://www.gnu.org/licenses/gpl.txt
okay that's the whole page bestie, you're officially policy-pilled π§β¨
and for the little sign-off moment: this was perl v5.36.0, dated 2022-12-07, filed under File::...nPolicy(3pm) β go forth and slurp responsibly, mwah πππ«Ά
π¦ where this page comes from
- debian bookworm: libfile-policy-perl 1.005-4 Β· GPL-2.0-or-later
- debian trixie: libfile-policy-perl 1.005-4 Β· GPL-2.0-or-later
- ubuntu noble: libfile-policy-perl 1.005-4 Β· GPL-2.0-or-later
- ubuntu resolute: libfile-policy-perl 1.005-4 Β· GPL-2.0-or-later
- ubuntu stonking: libfile-policy-perl 1.005-4 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms