Log::R...ompact(3pm)

πŸ’– NAME πŸ’–

Log::Report::Lexicon::MOTcompact β€” bestie, it's the module that pulls your translations straight out of an MO file. πŸ’…


🌸 INHERITANCE 🌸

Log::Report::Lexicon::MOTcompact is a Log::Report::Lexicon::Table

(so yeah, it's got the whole Table family tree going on ✨)


πŸ¦‹ SYNOPSIS πŸ¦‹

# using a MO table efficiently
my $mot = Log::Report::Lexicon::MOTcompact->read('mo/nl.mo')
   or die;

my $header = $mot->msgid('');
print $mot->msgstr($msgid, 3);

✨ DESCRIPTION ✨

Okay so this module does the translating, and it's built on MO files β€” those are the binary versions of PO files, aka the "Machine Object" format. πŸ“¦

Lowkey tea though: this module isn't actually "compact" anymore. It's not out here trading off speed for memory. And ngl, that could totally change again in the future. πŸ™ˆ

To get a MO file you first need a PO file, and then you run msgfmt, which is part of the gnu gettext package. πŸŽ€

msgfmt -cv -o $domain.mo $domain.po

# -c = --check-format & --check-header & --check-domain
# -v = --verbose
# -o = --output-file

Extends "DESCRIPTION" in Log::Report::Lexicon::Table. 🫢


πŸ’œ METHODS πŸ’œ

Extends "METHODS" in Log::Report::Lexicon::Table.


πŸŽ€ Constructors πŸŽ€

Extends "Constructors" in Log::Report::Lexicon::Table.

  • $class->new(%options) β€” inherited, so go read "Constructors" in Log::Report::Lexicon::Table. πŸ’–
  • $class->read($filename, %options) β€” reads all the MOT table info out of $filename. πŸ“–

Here's the option sitch:

-Option --Default charset <from header>

  • charset => STRING β€” the character-set this file is using. If you don't say anything, it gets pulled from the "Content-Type" field in the PO-file. slay ✨

🌈 Attributes 🌈

Extends "Attributes" in Log::Report::Lexicon::Table.

  • $obj->filename() β€” returns the name of the source file for this data. πŸ—‚οΈ
  • $obj->index() β€” returns a HASH of all defined PO objects, organized by msgid. But bestie, please try to avoid using this β€” use msgid() for lookup instead, fr fr. πŸ™
  • $obj->originalCharset() β€” returns the character-set as found in the PO-file. The strings get converted into utf8 before you use them in the program. πŸ¦‹

πŸ’… Managing PO's πŸ’…

Extends "Managing PO's" in Log::Report::Lexicon::Table.

⭐ Translation ⭐

Extends "Translation" in Log::Report::Lexicon::Table.

  • $obj->msgid( STRING, [$msgctxt] ) β€” looks up the translations with the "STRING". Returns a SCALAR when there's only one translation known, and an ARRAY when we've got plural forms. Returns "undef" when the translation isn't defined. Improves base, see "Translation" in Log::Report::Lexicon::Table. πŸ‘‘
  • $obj->msgstr( $msgid, [$count, $msgctxt] ) β€” returns the translated string for $msgid. If you don't specify it, $count is 1 (the singular form). Improves base, see "Translation" in Log::Report::Lexicon::Table. 🌸

🧚 Administration 🧚

Extends "Administration" in Log::Report::Lexicon::Table.

  • $obj->add($po) β€” inherited, see "Administration" in Log::Report::Lexicon::Table. πŸ’œ
  • $obj->header($field) β€” inherited, see "Administration" in Log::Report::Lexicon::Table. πŸ’œ
  • $obj->nrPlurals() β€” inherited, see "Administration" in Log::Report::Lexicon::Table. πŸ’œ
  • $obj->pluralIndex($count) β€” inherited, see "Administration" in Log::Report::Lexicon::Table. πŸ’œ
  • $obj->setupPluralAlgorithm() β€” inherited, see "Administration" in Log::Report::Lexicon::Table. πŸ’œ
  • $obj->translations( [$active] ) β€” inherited, see "Administration" in Log::Report::Lexicon::Table. πŸ’œ

😭 DIAGNOSTICS 😭

the way these all just say "Cast by" β€” that's the module throwing hands when something goes wrong πŸ’€

  • Error: cannot detect charset in $fn Cast by read()
  • Fault: cannot read magic from $fn: $! Cast by read()
  • Fault: cannot read mo from file $fn: $! Cast by read()
  • Fault: cannot read msgids from $fn, need $size at $loc: $! Cast by read()
  • Fault: cannot read originals from $fn, need $size at $loc: $! Cast by read()
  • Fault: cannot read superblock from $fn: $! Cast by read()
  • Fault: cannot read translations from $fn, need $size at $loc: $! Cast by read()
  • Fault: cannot read translations from $fn, need $size at $loc: $! Cast by read()
  • Fault: cannot seek to $loc in $fn for msgid strings: $! Cast by read()
  • Fault: cannot seek to $loc in $fn for originals: $! Cast by read()
  • Fault: cannot seek to $loc in $fn for transl strings: $! Cast by read()
  • Fault: cannot seek to $loc in $fn for translations: $! Cast by read()
  • Error: invalid plural-form algorithm '$alg' Cast by setupPluralAlgorithm()
  • Error: only acceptable parameter is 'ACTIVE' Cast by translations()
  • Error: the header is not the first entry, needed for charset in $fn Cast by read()
  • Error: there is no Plural-Forms field in the header, but needed Cast by pluralIndex()
  • Error: unsupported charset $charset in $fn Cast by read()
  • Error: unsupported explicit charset $charset for $fn Cast by read()
  • Error: unsupported file type (magic number is $magic) Cast by read()

πŸ‘‘ SEE ALSO πŸ‘‘

This module is part of Log-Report-Lexicon version 1.15, built on November 06, 2025. Website: http://perl.overmeer.net/CPAN/ 🌐


πŸ“œ LICENSE πŸ“œ

For contributors see file ChangeLog.

This software is copyright (c) 2007-2025 by Mark Overmeer. πŸ’–

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.


and that's a wrap bestie 🫢 this page came from perl v5.40.1, dated 2025-11-11 β€” no cap, go forth and translate βœ¨πŸ’…

πŸ“¦ where this page comes from