PPI::Do...nt::File(3)
β¨ PPI::Document::File β¨
okay bestie, so this is the manual page for PPI::Document::File β that's part of the PPI::Do...nt::File(3) manual, section 3 of the Perl docs, and it's giving very specific-file energy π
πΈ NAME πΈ
PPI::Document::File β a Perl Document that lives in one specific file ποΈβ¨
π¦ DESCRIPTION π¦
WARNING: this class is experimental, and it may change without notice. fr fr, no cap β do not build your whole personality on it staying the same π
PPI::Document::File hands you a PPI::Document subclass that represents a Perl document stored in a specific named file. like, it's not just a document, it's a document that knows which file it came from. main character with a home address π
π METHODS π
π new
my $file = PPI::Document::File->new( 'Module.pm' );
so the new constructor works exactly the same as the regular one, except β and this is the whole vibe β the only param allowed is a file name. that's it. that's the list.
you literally cannot create an "anonymous" PPI::Document::File object, and you cannot create an empty one either. no file, no object, periodt π ββοΈ
it returns a shiny new PPI::Document::File object, or undef if something went wrong π
π save
# Save to the file we were loaded from
$file->save;
# Save a copy to somewhere else
$file->save( 'Module2.pm' );
the save method works similarly to the one in the parent PPI::Document class β it saves a copy of the document to a file. same energy, mostly π«Ά
but here's the difference with this subclass: if save is not passed any filename, it will save it right back to the file it was loaded from. it remembers where it came from. iconic, honestly β¨
Note: when you save to a different file, that's considered saving a copy. so the value returned by the filename accessor will stay the same and will not change to the new filename. the object's home file does not move, bestie π
β TO DO β
- May need to overload some methods to forcefully prevent Document objects becoming children of another Node. (yes it's on the list, no it's not done yet π)
π SUPPORT π
see the support section in the main module π«Ά
π AUTHOR π
Adam Kennedy <adamk@cpan.org>
π COPYRIGHT π
Copyright 2001 - 2011 Adam Kennedy.
this program is free software; you can redistribute it and/or modify it under the same terms as Perl itself πͺ
the full text of the license can be found in the LICENSE file included with this module.
and that's the whole page, bestie!! this one came from perl v5.42.0, dated 2026-01-17, filed under PPI::Do...nt::File(3) in the User Contributed Perl Documentation. go forth and slay your file-based documents π β¨π¦
π¦ where this page comes from
- fedora 44: perl-PPI 1.284-2.fc44 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms