Badger...c::HTML(3pm)

πŸ“¦
version 0.16 Β· 4 versions
, in debian trixie, ubuntu noble, ubuntu resolute

πŸ’– 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 (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