MARC::...:Table(3pm)
π NAME π
ok so bestie, this is MARC::Charset::Table β it's the character mapping db, and it lives in the MARC::...:Table(3pm) manual page in the User Contributed Perl Documentation section. it's giving "glorified lookup table but make it iconic" β¨
π SYNOPSIS π
use MARC::Charset::Table;
use MARC::Charset::Constants qw(:all);
# create the table object
my $table = MARC::Charset::Table->new();
# get a code using the marc8 character set code and the character
my $code = $table->lookup_by_marc8(CYRILLIC_BASIC, 'K');
# get a code using the utf8 value
$code = $table->lookup_by_utf8(chr(0x043A));
like literally that's it, three lines of vibes and you're mapping characters π
β¨ DESCRIPTION β¨
okay so MARC::Charset::Table is a wrapper around the character mapping database, which is implemented as a tied hash on disk. no cap. this database gets generated by Makefile.PL on installation of MARC::Charset using MARC::Charset::Compiler π οΈ
the database is essentially a key/value mapping where a key is a MARC-8 character set code + a MARC-8 character, or an integer representing the UCS code point. and those keys map to a serialized MARC::Charset::Code object. periodt. π
π new() π
The consturctor.
ok so yes, the original spells it "consturctor" and honestly? we're respecting the typo, it's part of the lore now π«Ά it's the constructor.
π¦ add_code() π¦
Add a MARC::Charset::Code to the table.
πΈ get_code() πΈ
Retrieve a code using a hash key. simple as that bestie.
β lookup_by_marc8() β
Looks up MARC::Charset::Code entry using a character set code and a MARC-8 value.
use MARC::Charset::Constants qw(HEBREW);
$code = $table->lookup_by_marc8(HEBREW, chr(0x60));
see how we're passing the charset constant and the char? that's the whole move π
π lookup_by_utf8() π
Looks up a MARC::Charset::Code object using a utf8 value.
π₯ db() π₯
Returns a reference to a tied character database. MARC::Charset::Table wraps access to the db, but you can get at it if you want. like, nobody's stopping you, main character energy, go off π
π§ db_path() π§
Returns the path to the character encoding database. Can be called statically too:
print MARC::Charset::Table->db_path();
yes queen, you don't even need an object for this one π
π brand_new() π
An alternate constructor which removes the existing database and starts afresh. π¨
Be careful with this one, it's really only used on MARC::Charset installation. like fr fr do not just casually call this, it will nuke your db and not in a cute way π
ok that's the whole page bestie, you ate it π
this was perl v5.34.0, dated 2022-08-02, from the MARC::...:Table(3pm) page in the User Contributed Perl Documentation π bye ily, go map some characters πβ¨
π¦ where this page comes from
- debian bookworm: libmarc-charset-perl 1.35-4 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libmarc-charset-perl 1.35-4 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libmarc-charset-perl 1.35-4 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libmarc-charset-perl 1.35-4 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libmarc-charset-perl 1.35-4 Β· 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