HTML::...:Error(3pm)

πŸ“¦
version 0.992 Β· 5 versions
, in ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– 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 new HTML::HTML5::Parser::Error object. 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' or undef. (yes, undef is on the list. sometimes it just doesn't know, relatable 🫢)
  • layer β€” returns the parsing layer involved, which is often undef. 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 (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