MKDoc:...Decode(3pm)

πŸ“¦
version 0.75 Β· 3 versions
, in ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– 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 as A πŸ’…

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