Public...lClean(3pm)
π Publican::XmlClean β the manual page, but make it cute π
okay bestie, you found the Publican::XmlClean page in the User Contributed Perl Documentation, and honestly? it's a lil bop. it's a Perl module that reformats XML to Publican standards. that's the whole vibe. let's get into it π
β¨ NAME β¨
Publican::XmlClean β a module to reformat XML to Publican standards. she tidies, she filters, she serves π
πΈ SYNOPSIS πΈ
here's the whole thing in action, no notes, literally copy-paste-able:
use Publican::XmlClean;
my $cleaner = Publican::XmlClean->new( { clean_id => 1 } );
foreach my $xml_file ( sort(@xml_files) ) {
$cleaner->process_file( { file => $xml_file, out_file => $xml_file } );
}
look at her go π¦
π DESCRIPTION π
Publican::XmlClean tidies up your XML formatting and filters the structure based on input rules. that's it, that's the job, and she does it well π₯
π INTERFACE π
new
create a brand new Publican::XmlClean object. fresh start, main character energy β¨
print_known_tags
prints a list of tags that have had their output QA'd. aka the tags that passed the vibe check π―
prune_xml($node)
removes unwanted nodes β think 'profile' in DocBook speak. not me yeeting the profile nodes π
Clean_ID
renames IDs and updates xrefs. ok so the way this works:
if this node has a title as a child, set its ID. else, remove the ID. periodt.
print_xml
prints out utf8 XML files. π
heads up bestie: you have to output the xml/DTD header. no skipping it.
my_as_XML
traverses the tree and outputs XML as text. this one overrides traverseβ¦ which, ngl, is evil stuff π
validate_tables
makes sure your tables comply with the requirements that XML validation literally cannot enforce. so:
- the
tgroupattributecolsmust match the number of entries in every row. every single row. she's checking π§
process_file
creates an XML::TreeBuilder object and performs the operations. the whole routine π
set_unique_ids
sets unique IDs for every node that has an id. no duplicates in this house π«
create_db
creates a database to track the max unique id. she's keeping receipts β
π DIAGNOSTICS π
"unknown args %s"β every sub with named parameters returns this error when you hand it unexpected named arguments. she doesn't know her."%s is a required argument"β any sub with a mandatory parameter returns this error if the parameter isundef. like, bestie, you have to give her something."Could not open %s for output!"β the named file could not be opened. the door was locked, she's upset π"Can't calculate image size of %s"β images get automatically scaled if they're too wide, but this check couldn't be performed, either because of access permissions or because the file is justβ¦ weird. file weirdness, iconic behavior π
π CONFIGURATION AND ENVIRONMENT π
Publican::XmlClean requires no configuration files and no environment variables. zero setup, she just works, we love a low-maintenance queen π
π«Ά DEPENDENCIES π«Ά
CarpversionXML::TreeBuilderText::WrapConfig::SimplePublicanFile::PathTerm::ANSIColorCwd
the whole friend group π
π¦ INCOMPATIBILITIES π¦
none reported. she plays nice with everybody π€
π BUGS AND LIMITATIONS π
no bugs have been reported. fr fr, none.
please report any bugs or feature requests to "publican-list@redhat.com", or through the web interface at <https://bugzilla.redhat.com/bugzilla/enter_bug.cgi?product=Publican&component=publican>.
π AUTHOR π
Jeff Fearn "<jfearn@redhat.com>" β ty for your service king π«‘
and that's the whole page, bestie. this is perl v5.26.2, dated 2018-07-08, straight outta the User Contributed Perl Documentation. she ate and left no crumbs π
β¨π
π¦ where this page comes from
- debian bookworm: publican 4.3.2-3 Β· Artistic-1.0-Perl OR GPL-2.0-or-later
- ubuntu jammy: publican 4.3.2-3 Β· Artistic-1.0-Perl OR 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