HTML::...:Error(3pm)
π NAME π
HTML::HTML5::Parser::Error β the whole entire vibe of an error that occurred during parsing, bestie π«Ά (and yeah, the page header thing is literally HTML::...:Error(3pm), that's us, hi π)
β¨ DESCRIPTION β¨
okay so listen. the error_handler and errors methods of HTML::HTML5::Parser are the ones that generate these HTML::HTML5::Parser::Error objects. so when the parser has a whole moment, this is the little guy it hands you π
and the best part? HTML::HTML5::Parser::Error overloads stringification, so you can literally just print them, match them against regular expressions, whatever you want. it's giving "just works". iconic behavior fr fr π
lowkey important heads up: HTML::HTML5::Parser is not a validation tool. there are so many classes of error that it simply does not care about, so it will not raise. it's not being lazy, it's just not that kind of parser. no cap. π
π Constructor π
new(level=>$level, type=>$type, token=>$token, ...)β constructs a newHTML::HTML5::Parser::Errorobject. that's it, that's the whole thing. birthday time π
π¦ Methods π¦
levelβ returns the level of error. it's one of'MUST','SHOULD','WARN','INFO'orundef. (yes,undefis on the list. sometimes it just doesn't know, relatable π«Ά)layerβ returns the parsing layer involved, which is oftenundef. for example'encode'. so like, most of the time: mystery. sometimes: a name. main character energy honestly β¨typeβ returns the type of error, as a string.tag_nameβ returns the tag name (if any). if any!! πsource_lineβ oh this one's fancy, look:
($line, $col) = $error->source_line();
$line = $error->source_line;
in scalar context, source_line returns the line number of the source code that triggered the error.
in list context, it returns a line/column pair. and okay important detail bestie: tab characters count as one column, not eight. so don't come at it with your editor's tab width, it's not doing that π
to_stringβ returns a friendly error string. friendly!! it's being nice to you π₯Ή
π SEE ALSO π
HTML::HTML5::Parser. that's the one. go look at it. it's the whole reason we're here π
π AUTHOR π
Toby Inkster, <tobyink@cpan.org> β absolute legend, we stan π«Ά
π COPYRIGHT AND LICENSE π
Copyright (C) 2011-2012 by Toby Inkster
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. free software babes, we love to see it π
π DISCLAIMER OF WARRANTIES π
okay this part is in all caps in the original so I'm keeping the energy, it's serious business bestie:
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.
translation: no promises, no cap, use at your own risk π₯
signing off with the receipts: this beauty came out of perl v5.36.0, dated 2022-08-28, and the manpage name is HTML::...:Error(3pm). love that for us. bye bestie, go parse something π¦πβ¨
π¦ where this page comes from
- ubuntu noble: libhtml-html5-parser-perl 0.992-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libhtml-html5-parser-perl 0.992-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libhtml-html5-parser-perl 0.992-2 Β· 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