Badger...ncoding(3pm)
β¨ Badger::Codec::Encoding β¨
okay bestie, welcome to Badger::Codec::Encoding π
β it's a User Contributed Perl Documentation page and it's literally the base class codec for all the different encodings. sit down, hydrate, let's get into it π«Ά
πΈ NAME πΈ
Badger::Codec::Encoding β the base class codec for different encodings, no cap π
π SYNOPSIS π
like, here's the whole vibe in code form:
package My::Encoding::utf8;
use base 'Badger::Codec::Encoding';
use constant encoding => 'utf8';
package main;
my $codec = My::Encoding::utf8->new;
my $encoded = $codec->encode("...some utf8 data...");
my $decoded = $codec->decode($encoded);
see how easy that was?? iconic behaviour honestly β¨
π¦ DESCRIPTION π¦
okay so. this module is a subclass of Badger::Codec, and it also does double duty as a base class for a whole lil family of specific encoding modules. it's giving matriarch. it's giving "everyone's mom at the function" π
π METHODS π
π encoding()
this constant method returns the encoding for the codec, periodt. subclasses are expected to redefine this method so it returns a string representing their own specific encoding. like, do your own thing babe, that's the whole point π
π encode($data)
method for encoding data, obviously. it uses the encoding() method to figure out the encoding type, and then it calls the Encode encode() subroutine to do all the hard work. queen doesn't do her own heavy lifting π
$encoded = $codec->encode($uncoded);
π§ decode($data)
method for decoding data. same deal β it hits up the encoding() method to find the encoding type, then calls the Encode decode() subroutine to do all the hard work. teamwork makes the dream work fr fr πΈ
$decoded = $codec->decode($encoded);
β encoder()
this method returns a subroutine reference that you can call to encode data. so you get a lil function you can pass around like a trading card π
my $encoder = $codec->encode;
$encoded = $encoder->($data);
π₯ decoder()
this method returns a suboroutine reference that you can call to decode data. yes, "suboroutine" β that's what the original says, we do not edit the sacred texts π
my $decoder = $codec->decode;
$decoded = $decoder->($data);
π AUTHOR π
Andy Wardley <http://wardley.org/> β a whole legend π«Ά
π COPYRIGHT π
Copyright (C) 2005-2009 Andy Wardley. All rights reserved.
(yes bestie, all of them. every single right. reserved.) β¨
π SEE ALSO π
go read these next, they're all in the same cinematic universe:
EncodeBadger::Codec::EncodeBadger::Codec::UnicodeBadger::CodecsBadger::Codec
and that's the whole page bestie!! this was served up by perl v5.36.0 on 2023-08-28, and yeah the title got squished into Badger...ncoding(3pm) like a lil nickname π₯Ή β go forth and encode, main character ππ¦π
π¦ 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