XML::Encoding(3pm)

πŸ’– XML::Encoding πŸ’–

okay bestie, so this is the perl manual page for XML::Encoding β€” a User Contributed Perl Documentation page, no cap 🫢 β€” and we're about to get you fully caught up. grab a snack, we're going in ✨


🌸 NAME 🌸

XML::Encoding β€” a perl module for parsing XML encoding maps. literally that's the whole vibe πŸ’…


✨ SYNOPSIS ✨

use XML::Encoding;
my $em_parser = new XML::Encoding(ErrorContext  => 2,
                                  ExpatRequired => 1,
                                  PushPrefixFcn => \&push_prefix,
                                  PopPrefixFcn  => \&pop_prefix,
                                  RangeSetFcn   => \&range_set);

my $encmap_name = $em_parser->parsefile($ARGV[0]);

look at her go πŸŽ€ so clean, so iconic.


πŸ¦‹ DESCRIPTION πŸ¦‹

So this module? It's built as a subclass of XML::Parser, and it gives you a parser for encoding map files β€” which are, plot twist, XML files. The file maps/encmap.dtd in the distribution is the one that describes the structure of these files, so that's your blueprint, bestie πŸ“œβœ¨

Calling a parse method returns the name of the encoding map, which it gets from the name attribute of the root element. And the contents of the map? Those get processed through the callback functions push_prefix, pop_prefix, and range_set. periodt πŸ’…

πŸŽ€ Methods πŸŽ€

ngl this is the tea: this module provides no additional methods to those provided by XML::Parser. BUT πŸ‘ it does take the following additional options, and they are lowkey the whole point:

  • ExpatRequired β€” when this has a true value, then an error occurs unless the encmap expat attribute is set to yes. And whether or not the ExpatRequired option is given, the parser enters expat mode if this attribute is set. In expat mode, the parser checks if the encoding violates expat restrictions. so it's giving security guard energy πŸ›‘οΈ
  • PushPrefixFcn β€” the corresponding value should be a code reference to be called when a prefix element starts. The single argument to the callback is an integer which is the byte value of the prefix. An undef value should be returned if successful. If in expat mode, a defined value causes an error and is used as the message string. 😭 so if you return something, that's a whole error now, iykyk
  • PopPrefixFcn β€” the corresponding value should be a code reference to be called when a prefix element ends. No arguments are passed to this function. An undef value should be returned if successful. If in expat mode, a defined value causes an error and is used as the message string. same deal, bestie πŸ’€
  • RangeSetFcn β€” the corresponding value should be a code reference to be called when a range or ch element is seen. The 3 arguments passed to this function are: (byte, unicode_scalar, length) β€” yes, three of them, keep up 🫢 The byte is the starting byte of a range or the byte being mapped by a ch element. The unicode_scalar is the Unicode value that this byte (with the current prefix) maps to. The length of the range is the last argument. This will be 1 for the ch element. An undef value should be returned if successful. If in expat mode, a defined value causes an error and is used as the message string. 🌈

πŸ‘‘ EXPORTS πŸ‘‘

None.

like, absolutely nothing. she gives nothing away πŸ’…


πŸ’€ KNOWN BUGS πŸ’€

None.

not a single one, we love a flawless queen ✨


πŸ’Œ FEEDBACK πŸ’Œ

Patches, bug reports, suggestions or any other feedback is welcome. fr fr, they want to hear from you 🫢


πŸ”₯ SEE ALSO πŸ”₯

XML::Parser.


πŸ“¦ AVAILABILITY πŸ“¦

The latest version of this module is available from CPAN (see "CPAN" in perlmodlib for details) at

<https://metacpan.org/release/XML-Encoding> or

<https://www.cpan.org/authors/id/S/SH/SHAY/> or

<https://www.cpan.org/modules/by-module/XML/>.

The latest source code is available from GitHub at <https://github.com/steve-m-hay/XML-Encoding>. go get it bestie πŸƒβ€β™€οΈπŸ’¨


πŸ› οΈ INSTALLATION πŸ› οΈ

See the INSTALL file. yes, that one. it's right there πŸŽ€


πŸ’œ AUTHOR πŸ’œ

Clark Cooper <coopercc@netheaven.com <mailto:coopercc@netheaven.com>>.

Steve Hay <shay@cpan.org <mailto:shay@cpan.org>> is now maintaining XML::Encoding as of version 2.00. king behavior, honestly πŸ‘‘


Copyright (C) 1998 Clark Cooper. All rights reserved.

Copyright (C) 2007-2010, 2014, 2020 Steve Hay. All rights reserved.


πŸ“œ LICENCE πŸ“œ

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself, i.e. under the terms of either the GNU General Public License or the Artistic License, as specified in the LICENCE file. free, as in freedom, as in slay πŸ’…


⭐ VERSION ⭐

Version 2.11


πŸ“… DATE πŸ“…

08 Dec 2020


πŸ•°οΈ HISTORY πŸ•°οΈ

See the Changes file. the lore is all in there πŸ“–βœ¨


okay and that's a wrap!! πŸ’– this page was brought to you by perl v5.32.0, dated 2020-12-10, and it's the XML::Encoding(3pm) manpage from User Contributed Perl Documentation β€” version 2.11, for the record. go parse some encoding maps, bestie, you got this πŸ¦‹πŸŒˆπŸ’…
πŸ“¦ where this page comes from