Log::R...t::Util(3pm)

🌸 Log::R...t::Util β€” the whole vibe πŸ’…

okay bestie, welcome to Log::R...t::Util, aka helpful routines to Log::Report ✨ (that's from the Perl 5 user-contributed documentation set, and it's the Log::R...t::Util manual page, so you're in the right place fr fr 🫢).


🧬 INHERITANCE

Log::R...t::Util is an Exporter πŸŽ€

(yeah she hands out her functions, she's generous like that πŸ’–)


✨ SYNOPSIS

my ($language, $territory, $charset, $modifier)
   = parse_locale 'nl_BE.utf-8@home';

my @take = expand_reasons 'INFO-ERROR,PANIC';

like look at her, two whole calls and she's already serving 😌πŸ”₯


πŸ’¬ DESCRIPTION

Bestie. Listen. This module is literally just a lil grab-bag of functions and definitions that all the different pieces of the Log::Report infrastructure share between themselves. That's it. That's the whole thing. 🫢

It's giving internal plumbing, ngl β€” end-user apps shouldn't need it, so if you're just writing an app you can lowkey skip it. But this man-page does have some genuinely useful background info in it, so stick around if you're curious πŸ‘€βœ¨


πŸ”§ FUNCTIONS

🧠 Reasons

expand_reasons($reasons)

She takes your $reasons string and hands back a sub-set of all existing message reason labels based on what you wrote. Here are the rules, and they are the rules, periodt:

REASONS     = BLOCK [ ',' BLOCKS ] | ARRAY-of-REASON
BLOCK       = '-' TO | FROM '-' TO | ONE | SOURCE
FROM,TO,ONE = 'TRACE' | 'ASSERT' | ,,, | 'PANIC'
SOURCE      = 'USER' | 'PROGRAM' | 'SYSTEM' | 'FATAL' | 'ALL' | 'NONE'

The SOURCE specification groups together all the reasons that are usually related to the problem: it reports about problems caused by the user, reported by the program, or with system interaction. πŸ’…

example: of expended REASONS πŸ‘‘

WARNING-FAULT # == WARNING,MISTAKE,ERROR,FAULT
WARNING,INFO  # == WARNING,INFO
-INFO         # == TRACE-INFO
ALERT-        # == ALERT,FAILURE,PANIC
USER          # == MISTAKE,ERROR
ALL           # == TRACE-PANIC
FATAL         # == ERROR,FAULT,FAILURE,PANIC [1.07]
NONE          # ==
no cap, that NONE line really does give you nothing. iconic honestly 😭

is_fatal($reason)

Returns "true" if the $reason is severe enough to cause an exception (or program termination). ⚠️ like, she will end things. literally.


is_reason($name)

Returns "true" if the STRING is one of the predefined REASONS. simple, chic, no notes πŸ’…


use_errno($reason)

(no description given here, bestie β€” the manpage just leaves her standing there looking pretty πŸŽ€ that's all it says.)


πŸŒ€ Modes

Run-modes are explained in Log::Report::Dispatcher. ✨ go read that one too, iykyk.


mode_accepts($mode)

Returns something acceptable by expand_reasons(). 🫢


mode_number($name|$mode)

Returns the $mode as number. πŸ”’


must_show_location($mode, $reason)

(she's here. the manpage doesn't say more than her signature.)


must_show_stack($mode, $reason)

(also here. same deal. 😌)


🌈 Other

escape_chars(STRING)

Replace all escape characters into their readable counterpart. For instance, a new-line is replaced by backslash-n. πŸ¦‹


parse_locale(STRING)

Decompose a locale string. 🧚

For simplicity of the caller's code, the capatization of the returned fields is standardized to the preferred, although the match is case-insensitive as required by the RFC. πŸ“œ The territory is returned in capitals (ISO3166), the language is lower-case (ISO639), the script as upper-case first, the character-set as lower-case, and the modifier and variant unchanged.

In LIST context, four elements are returned: language, territory, character-set (codeset), and modifier. Those four are important for the usual unix translationg infrastructure. Only the "country" is obligatory, the others can be "undef". It may also return "C" and "POSIX". πŸ‘‘

In SCALAR context, a HASH is returned which can contain more information: language, script, territory, variant, codeset, and modifiers. The variant (RFC3066 is probably never used). πŸ‘€


pkg2domain( $package, [$domain, $filename, $line] )

With $domain, $filename and $line, this registers a location where the textdomain is specified. Each $package can only belong to one $domain. πŸ’– monogamy fr fr.

Without these parameters, the registered domain for the $package is returned. πŸŽ€


to_html($string)

[1.02] Escape HTML volatile characters. 🌸


unescape_chars(STRING)

Replace all backslash-something escapes by their escape character. For instance, backslash-t is replaced by a tab character. ✨


🚨 DIAGNOSTICS

  • Error: reason $begin more serious than $end in $reasons β€” Cast by expand_reasons(). πŸ’€ yeah she caught you.
  • Error: unknown locale language in locale $locale' β€” Cast by parse_locale(). 😭
  • Error: unknown reason $which in $reasons β€” Cast by expand_reasons().
  • Error: unknown reason $which in $reasons β€” Cast by expand_reasons(). (yes bestie, it's listed twice up there. i'm not deleting it, i keep the details fr fr πŸ’…)

πŸ‘€ SEE ALSO

This module is part of Log-Report-Optional version 1.08, built on September 08, 2025. Website: http://perl.overmeer.net/CPAN/ 🌈


πŸ“œ LICENSE

For contributors see file ChangeLog. πŸ™ˆ

This software is copyright (c) 2013-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 the whole page, bestie! 🌟 she was rendered by perl v5.40.1 on 2025-10-04, and yes she's still hanging out in the Log::R...t::Util(3pm) corner of the manual πŸ’œ mwah, go read some code now βœ¨πŸŽ€

πŸ“¦ where this page comes from