MKDoc:...Decode(3pm)
π MKDoc:...Decode β bestie edition π
okay so this is a page from the User Contributed Perl Documentation for MKDoc:...Decode(3pm), which is genuinely one of the cutest little modules you'll ever meet. it expands XML entities. that's the whole job. slay.
β¨ NAME β¨
MKDoc::XML::Decode β expanding XML entities, no cap π«Ά
β¨ SYNOPSIS β¨
look at this. it's giving "tiny and powerful".
use MKDoc::XML::Decode;
my $decode = new MKDoc::XML::Decode qw/xml xhtml numeric/;
# $xml is now "Chris' Baloon"
my $xml = MKDoc::XML::Decode->process ("Chris' Baloon");
so you make the object, you hand it your entity modules, and it just handles it. ' becomes an apostrophe. iconic behaviour honestly.
β¨ SUMMARY β¨
okay so MKDoc::XML::Decode is a very simple module with a pluggable entity decoding mechanism β like, you pick your modules and it does the rest. πΈ
at the moment there are three modules, and here's what each one eats:
xmlβ decodes'"><and&π§xhtmlβ decodes XHTML entities such aséβ¨numericβ decodes numeric entities such asAπ
and that's it. that's the whole module. no notes.
lowkey important: this module and its counterpart MKDoc::XML::Encode are used by MKDoc::XML::Dumper to XML-encode and XML-decode litterals. so they're not just hanging out, they're employed. π
β¨ API β¨
π my $decode_object = new MKDoc::XML::Decode (@modules);
constructs a new decode object using the modules specified in @modules. that's your xml / xhtml / numeric besties. pick what you need. π
π my $decoded = $decode_object->decode ($stuff);
decodes $stuff and returns it into $decoded. easy.
π¨ okay so important warning time: any entity which is not recognized will be returned as is, but it will trigger a warning. so if your output looks weird and your terminal is yelling, that's the reason. don't say nobody told you bestie π
β¨ AUTHOR β¨
Copyright 2003 - MKDoc Holdings Ltd. π
Author: Jean-Michel Hiver π«
This module is free software and is distributed under the same license as Perl itself. Use it at your own risk. β οΈ
β¨ SEE ALSO β¨
MKDoc::XML::Encodeβ the counterpart, the other half, the duo π¦
and that's the page!! π this one shipped with perl v5.36.0 and is dated 2022-10-13. go forth and decode responsibly πβ¨
π¦ where this page comes from
- ubuntu noble: libmkdoc-xml-perl 0.75-6 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libmkdoc-xml-perl 0.75-6 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libmkdoc-xml-perl 0.75-6 Β· 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