PFT::Content::File(3)
π 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. πunlinkrename_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 howunlinkandrename_asare 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
- fedora 43: perl-PFT 1.4.1-18.fc43 Β· GPL-3.0-or-later
- fedora 44: perl-PFT 1.4.1-18.fc43 Β· GPL-3.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms