XML::E...lassify(3pm)
π XML::Easy::Classify π
okay bestie, so this is a Perl module (from the User Contributed Perl Documentation corner of the universe) and it's genuinely so useful β it's the vibe check station for all your XML-ish data. It's literally called XML::Easy::Classify and it does exactly what it says on the tin: it classifies XML-related items. π
β¨ SYNOPSIS β¨
lowkey just import the ones you want, bestie:
use XML::Easy::Classify qw(
is_xml_name check_xml_name
is_xml_encname check_xml_encname
is_xml_chardata check_xml_chardata
is_xml_attributes check_xml_attributes
is_xml_content_object check_xml_content_object
is_xml_content_twine check_xml_content_twine
is_xml_content check_xml_content
is_xml_element check_xml_element);
if(is_xml_name($arg)) { ...
check_xml_name($arg);
if(is_xml_encname($arg)) { ...
check_xml_encname($arg);
if(is_xml_chardata($arg)) { ...
check_xml_chardata($arg);
if(is_xml_attributes($arg)) { ...
check_xml_attributes($arg);
if(is_xml_content_object($arg)) { ...
check_xml_content_object($arg);
if(is_xml_content_twine($arg)) { ...
check_xml_content_twine($arg);
if(is_xml_content($arg)) { ...
check_xml_content($arg);
if(is_xml_element($arg)) { ...
check_xml_element($arg);
see how every is_ has a matching check_? they're giving β¨matched setβ¨ energy. π«Ά
πΈ DESCRIPTION πΈ
so this module hands you a lil bundle of type-testing functions, and likeβ¦ all of them are about the data types used over in the XML::Easy ensemble. their main-character purpose in life is to enforce validity of data that's getting processed by XML-related functions. no cap. π
there are two flavours of function up in here, and honestly the duality is iconic:
- flavour one only does type classification β it lets your code discriminate between argument types. just pure "which one are you, bestie?" energy.
- flavour two packages up the most common kind of type discrimination: it checks that an argument is of an expected type. like, "I already know what I want and you'd better be it."
and the way that they come in matched pairs? obsessed. π
β FUNCTIONS β
here's the whole tea, and it applies to every single one of them:
every function takes one scalar argument (ARG) to be tested. any scalar value whatsoever is acceptable as that argument β literally anything, no judgement, we accept all scalars here. π¦
- every
"is_"function returns a simple truth value result, which is true iffARGis of the type being checked for. - every
"check_"function will return normally if the argument is of the type being checked for, or it willdieif it is not. dramatic? maybe. correct? yes. π
is_xml_name(ARG)
check_xml_name(ARG)
check whether ARG is a plain string satisfying the XML name syntax. these names are the ones used to identify element types, attributes, entities, and other things in XML. so like, the name-tag-on-your-backpack of the XML world. π
is_xml_encname(ARG)
check_xml_encname(ARG)
check whether ARG is a plain string satisfying the XML character encoding name syntax. yes, encoding names are their own whole syntax. she's specific. π
is_xml_chardata(ARG)
check_xml_chardata(ARG)
check whether ARG is a plain string consisting of a sequence of characters that are acceptable to XML. such a string is valid as data in an XML element (where it may be intermingled with subelements) or as the value of an element attribute. so this one's the "are you legal to justβ¦ exist as text in here" test. πΈ
is_xml_attributes(ARG)
check_xml_attributes(ARG)
check whether ARG is a reference to a hash that is well-formed as an XML element attribute set. for it to be well-formed, both of these gotta hold, fr fr:
- each key in the hash must be an XML name string.
- each value must be an XML character data string.
no rogue keys, no rogue values. well-formed or bust. β¨
is_xml_content_object(ARG)
check_xml_content_object(ARG)
check whether ARG is a reference to an XML::Easy::Content object, and thus represents a chunk of XML content. π
is_xml_content_twine(ARG)
check_xml_content_twine(ARG)
check whether ARG is a reference to a twine array (see "Twine" in XML::Easy::NodeBasics), and thus represents a chunk of XML content. yep, same content-chunk energy, just the twine flavour. π§΅
is_xml_content_array(ARG)
heads up bestie: this one is a deprecated alias for "is_xml_content_twine". she's still here but likeβ¦ you know. use the twine one. π
is_xml_content(ARG)
check_xml_content(ARG)
check whether ARG is a reference to either an XML::Easy::Content object or a twine array (see "Twine" in XML::Easy::NodeBasics), and thus represents a chunk of XML content. it's the "either one of y'all works" function and honestly that inclusivity ate. π
is_xml_element(ARG)
check_xml_element(ARG)
check whether ARG is a reference to an XML::Easy::Element object, and thus represents an XML element. the full element experience. π
π SEE ALSO π
- Params::Classify
- XML::Easy::NodeBasics
go read those too, bestie, they're part of the lore. iykyk. π¦
π AUTHOR π
Andrew Main (Zefram) <zefram@fysh.org> β legend behaviour, honestly. π
π COPYRIGHT π
Copyright (C) 2009, 2010, 2011, 2017 Andrew Main (Zefram) <zefram@fysh.org>
π LICENSE π
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. slay. β¨
and that's the whole page, bestie!! π
this doc was served up as User Contributed Perl Documentation for perl v5.42.3, dated 2026-08-22 β so go classify literally everything, and remember: <red> check_ functions </red> die on you, so wrap accordingly. mwah, love u, bye!! πππ«ΆπΈπ
π¦ where this page comes from
- ubuntu stonking: libxml-easy-perl 0.014-1build1 Β· 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