DumpXML::Parser(3pm)
π DumpXML::Parser π
okay bestie, so this is a page from the User Contributed Perl Documentation for the DumpXML::Parser manual (3pm section) and honestly? it's a little gem. let's get into it π«Ά
β¨ NAME β¨
Data::DumpXML::Parser β literally the "undo" button for stuff you dumped with Data::DumpXML. Restore data dumped by Data::DumpXML, no cap.
πΈ SYNOPSIS πΈ
the vibe check, in code form:
use Data::DumpXML::Parser;
my $p = Data::DumpXML::Parser->new;
my $data = $p->parsefile(shift || "test.xml");
π¦ DESCRIPTION π¦
So Data::DumpXML::Parser is an XML::Parser subclass β like, it inherited the whole personality but picked up a new hobby π
β and what it does is recreate the data structure from an XML document that was produced by Data::DumpXML.
The parserfile() method hands you back a reference to an array of the values that got dumped. that's it, that's the whole glow-up β¨
π the constructor π
The constructor method new() takes one single additional argument on top of whatever XML::Parser already takes. just the one. and it's this:
Blesser => CODEREFβ a subroutine that gets invoked to bless the restored objects. The way it works: the subroutine is called with two arguments β a reference to the object, and a string containing the class name. If you don't provide one, the built-inblessfunction gets used instead. default behaviour, no extra work required π«Ά
β οΈ okay real talk, listen up: if the input file can't necessarily be trusted, blessing arbitrary Classes might give malicious input the ability to exploit the DESTROY methods of modules used by your code. that is not the vibe. so for those situations it's a good idea to provide a no-op blesser:
my $p = Data::DumpXML::Parser->new(Blesser => sub {});
see how that sub just... does nothing? iconic. does nothing, protects everything π β¨
π₯ SEE ALSO π₯
Data::DumpXMLXML::Parser
go read those too, iykyk π
π AUTHOR π
Copyright 2001 Gisle Aas.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. fr fr, that's the whole license tea β
and that's the page, bestie!! π it's giving perl v5.34.0, dated 2022-06-12, and it lives in the DumpXML::Parser(3pm) era of the manual pages. go forth and parse responsibly, mwah ππ
πΈ
π¦ where this page comes from
- debian bookworm: libdata-dumpxml-perl 1.06-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libdata-dumpxml-perl 1.06-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libdata-dumpxml-perl 1.06-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libdata-dumpxml-perl 1.06-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libdata-dumpxml-perl 1.06-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms