File::...nPolicy(3pm)

πŸ“¦
version 1.005 Β· 2 versions
  • 1.005 Β· debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking (latest)
  • 1.005 Β· ubuntu jammy
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– 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>


(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 πŸ’–πŸŽ€πŸ«Ά