Badger...c::HTML(3pm)
π NAME π
Badger::Codec::HTML β it encodes and decodes the reserved characters in HTML, bestie. That's the whole gig. π
β¨ SYNOPSIS β¨
use Badger::Codec::HTML;
# class methods
my $enc = Badger::Codec::HTML->encode("http://foo.com/bar.html");
my $dec = $codec->decode($enc);
# object methods
my $codec = Badger::Codec::HTML->new();
my $enc = $codec->encode("http://foo.com/bar.html");
my $dec = $codec->decode($enc);
look at her. class methods AND object methods. versatile queen. π
πΈ DESCRIPTION πΈ
Okay so Badger::Codec::HTML is a subclass of Badger::Codec, and it's here to encode and decode HTML. It's built on code that was extracted from Lincoln Stein's CGI.pm module. Respect the lineage fr fr. π§
The encode() method encodes HTML by converting any reserved characters into the correct HTML entities.
The decode() method reverses this process. symmetry!! we love to see it π
π¦ METHODS π¦
π encode($html, $charset)
Encodes the HTML text passed as the first argument. just hand her the text and she handles it.
$encoded = Badger::Codec::HTML->encode($html);
The optional second argument can be used to indicate the character set in use. If this is set to "ISO-8859-1" "WINDOWS-1252" then the encoded data will undergo some additional processing in order to work around some known bugs in Microsoft's web browsers. See fix_windows().
yes bestie, actual browser bugs, and yes, we're fixing them from over here. iconic behaviour honestly. π
π decode($html)
Decodes the encoded HTML text passed as the first argument. the un-encoding. the reverse slay.
$html = Badger::Codec::HTML->decode($encoded);
π fix_windows($text)
This method is used internally to repair the damage caused by bugs in certain inferior browsers. she said what she said. π
π AUTHOR π
Andy Wardley <http://wardley.org/> β the icon, the legend. π«Ά
π COPYRIGHT π
Copyright (C) 2005-2009 Andy Wardley. All rights reserved.
π ACKNOWLEDGEMENTS π
This code is derived from Lincoln D. Stein's CGI module. giving credit where credit is due, as one should. β¨
β SEE ALSO β
Badger::Codecβ the parent, the blueprint, the main character she inherited her whole vibe from. π
and that's the whole page bestie, no cap. π¦ This little writeup came to you from perl v5.36.0, dated 2023-08-28, and it lives under the name Badger...c::HTML(3pm) in the User Contributed Perl Documentation. go forth and encode responsibly. ππ
πΈ
π¦ where this page comes from
- debian trixie: libbadger-perl 0.16-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libbadger-perl 0.16-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libbadger-perl 0.16-3 Β· 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