PFT::Content::File(3)

πŸ“¦ version 1.4.1, in fedora 43, fedora 44

πŸ’– PFT::Content::File πŸ’–

okay so bestie, welcome to PFT::Content::File(3) β€” yeah that's the manual name, it's giving very "chapter three of the Perl docs", and honestly? iconic. this is the User Contributed Perl Documentation page and it's all about a content file that lives on your disk. let's get into it 🫢


✨ NAME ✨

PFT::Content::File β€” the on-disk content file. that's it, that's the whole vibe. a file. on a disk. we love her πŸ’…


🌸 SYNOPSIS 🌸

here's how you actually summon one, no cap:

use PFT::Content::File;

my $f1 = PFT::Content::File->new({
    tree => $tree,
    path => $path,
    name => $name,  # optional, defaults to basename($path)
});

so like. tree, path, and optionally name (which, if you don't hand it over, lowkey just defaults to basename($path) β€” she figures it out herself, main character energy fr fr).


πŸ¦‹ DESCRIPTION πŸ¦‹

this class describes a content file on disk. that's the whole job. she's a little object that knows about a file sitting on your filesystem, and she's got opinions (properties) about it.


πŸŽ€ Properties πŸŽ€

okay so besides everything listed down here, there's more stuff she inherits from "PFT::Content::Base" β€” like, she's not doing all of this alone, she's got a whole family tree of inherited properties. periodt. anyway, here's what's hers:

  • path β€” the absolute path of the file on the filesystem. like, the whole entire address, no shortcuts. πŸ“
  • encpath β€” the absolute path, but encoded with locale. same file, different fit. ✨
  • filename β€” the base name of the file. just the name-name, not the whole path situation. πŸŽ€
  • mtime β€” last modification time, according to the filesystem. the file's own little "when did i last change" receipt. ⏰
  • open β€” opens a file descriptor for the file, like:
$f->open        # Read file descriptor
$f->open($mode) # Open with r|w|a mode

and the best part?? she does automatic error checking β€” if something goes wrong she confesses on error. so if it breaks, you will hear about it. no silent suffering. 😭

  • touch β€” changes the modification time on the filesystem to the current timestamp. a lil glow-up for the mtime, she's fresh now. πŸ’…
  • exists β€” verifies if the file exists. are you there bestie?? πŸ‘€
  • empty β€” checks if the file is empty. sometimes the vibe is just... nothing. πŸ’€
  • unlink
  • rename_as β€” moves the file in the filesystem, and updates the internal data to match. she moves and she updates her own receipts, we stan a self-aware queen. πŸ¦‹
ngl, notice how unlink and rename_as are listed together up there β€” that's exactly how the original page lays them out, so that's how we're keeping them. no merging, no inventing, we don't do that here. πŸ™ˆ

🌈 a lil sign-off 🌈

and that's the page, bestie!! this whole thing comes from perl v5.42.0, dated 2025-07-25 β€” so go forth and PFT::Content::File your heart out. you're gonna slay, fr fr. πŸ’–βœ¨πŸŽ€πŸ¦‹πŸŒΈπŸ’…πŸ«ΆπŸ‘‘

πŸ“¦ where this page comes from