HTML::...ilities(3pm)
π NAME π
HTML::Microformats::Utilities β the little helper drawer for the HTML::Microformats fam, bestie. It's a utility functions for searching and manipulating HTML situation. β¨
(You're reading the User Contributed Perl Documentation page for it, manual section 3pm, so likeβ¦ yes, it's a Perl module, we know. π«Ά)
πΈ DESCRIPTION πΈ
Okay so this module is literally just a handful of functions that let you search and manipulate HTML trees. That's the whole vibe. No cap. π
π searchClass($class, $node, [$prefix])
Gives you back a list of elements that are descendents of $node and that have the class name $class. π
$class can be a plain string, or a regular expression. Either one, your call, slay.
And if you pass $prefix? It gets used as an optional prefix for $class. Example time, because this part is iconic: with $class as 'bar' and $prefix as 'foo', searchClass will go looking for all of these classes:
'bar''foobar''foo-bar''foo:bar'
not me being obsessed with how tidy that is π
π¦ searchAncestorClass($class, $node, [$skip])
Returns the first element which is an ancestor of $node and has the class name $class. Going up the family tree, basically. π³
$class can be a plain string, or a regular expression. Same deal as before.
$skip is the number of levels of ancestor to skip. Watch this, because the counting is the whole plot twist:
- If
$skipis0, then potentiallysearchAncestorClasswill return$nodeitself. π³ - If
$skipis1, then it will not return$node, but it could potentially return its parent. - β¦and so on. You get the pattern, bestie. π
π searchRel($relationship, $node)
Returns a list of elements which are descendents of $node and have the relationship $relationship. β¨
$relationship can be a plain string, or a regular expression. (Are you sensing a theme? You should be. It's giving consistency. π«Ά)
π searchRev($relationship, $node)
Exactly as per searchRel, but it uses the rev attribute instead. Same energy, different attribute. π
π searchID($id, $node)
Returns a descendent of $node with the id attribute $id, or undef. Simple. Clean. Ate. π₯
π§ searchAncestorTag($tagname, $node)
Returns the nearest ancestor of $node with tag name $tagname, or undef. Closest one wins, no cap. π
β stringify($node, \%options)
Returns a stringified version of a DOM element. Conceptually this is equivalent to $node->textContent, BUT β and this is the important part, bestie β it follows microformat-specific stringification rules, including value excerption, the abbr pattern and so on. So like, don't just assume it's textContent, because it is not. π
π xml_stringify($node)
Returns an XML serialisation of a DOM element. Conceptually equivalent to $node->toStringEC14N, but it hides certain attributes which HTML::Microformats::DocumentContext adds for internal processing. So the internals stay internal. As they should. π
π BUGS π
Please report any bugs to <http://rt.cpan.org/>. That's the spot. Go off. π«Ά
π SEE ALSO π
HTML::Microformats
β¨ AUTHOR β¨
Toby Inkster <tobyink@cpan.org>. π
π COPYRIGHT AND LICENCE π
Copyright 2008-2012 Toby Inkster
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. π
π DISCLAIMER OF WARRANTIES π
THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
(Yes, that's all-caps for a reason. It means it, fr fr. π)
perl v5.32.1 Β· 2021-09-12 β that's the version and date this page came from, bestie. Thanks for reading the whole HTML::Microformats::Utilities manpage with me, you're literally the main character. ππ byeee π«Άβ¨
π¦ where this page comes from
- debian bookworm: libhtml-microformats-perl 0.105-6 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libhtml-microformats-perl 0.105-6 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu jammy: libhtml-microformats-perl 0.105-6 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libhtml-microformats-perl 0.105-6 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libhtml-microformats-perl 0.105-6 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libhtml-microformats-perl 0.105-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