1Log::Report::Util(3) User Contributed Perl Documentation Log::Report::Util(3)
2
3
4
6 Log::Report::Util - helpful routines to Log::Report
7
9 Log::Report::Util
10 is a Exporter
11
13 my ($language, $territory, $charset, $modifier)
14 = parse_locale 'nl_BE.utf-8@home';
15
16 my @take = expand_reasons 'INFO-ERROR,PANIC';
17
19 This module collects a few functions and definitions which are shared
20 between different components in the Log::Report infrastructure. They
21 should not be needed for end-user applications, although this man-page
22 may contain some useful background information.
23
25 Reasons
26 expand_reasons($reasons)
27 Returns a sub-set of all existing message reason labels, based on
28 the content $reasons string. The following rules apply:
29
30 REASONS = BLOCK [ ',' BLOCKS ] | ARRAY-of-REASON
31 BLOCK = '-' TO | FROM '-' TO | ONE | SOURCE
32 FROM,TO,ONE = 'TRACE' | 'ASSERT' | ,,, | 'PANIC'
33 SOURCE = 'USER' | 'PROGRAM' | 'SYSTEM' | 'FATAL' | 'ALL' | 'NONE'
34
35 The SOURCE specification group all reasons which are usually
36 related to the problem: report about problems caused by the user,
37 reported by the program, or with system interaction.
38
39 example: of expended REASONS
40
41 WARNING-FAULT # == WARNING,MISTAKE,ERROR,FAULT
42 WARNING,INFO # == WARNING,INFO
43 -INFO # == TRACE-INFO
44 ALERT- # == ALERT,FAILURE,PANIC
45 USER # == MISTAKE,ERROR
46 ALL # == TRACE-PANIC
47 FATAL # == ERROR,FAULT,FAILURE,PANIC [1.07]
48 NONE # ==
49
50 is_fatal($reason)
51 Returns true if the $reason is severe enough to cause an exception
52 (or program termination).
53
54 is_reason($name)
55 Returns true if the STRING is one of the predefined REASONS.
56
57 use_errno($reason)
58
59 Modes
60 Run-modes are explained in Log::Report::Dispatcher.
61
62 mode_accepts($mode)
63 Returns something acceptable by expand_reasons()
64
65 mode_number($name|$mode)
66 Returns the $mode as number.
67
68 must_show_location($mode, $reason)
69 must_show_stack($mode, $reason)
70
71 Other
72 escape_chars(STRING)
73 Replace all escape characters into their readable counterpart. For
74 instance, a new-line is replaced by backslash-n.
75
76 parse_locale(STRING)
77 Decompose a locale string.
78
79 For simplicity of the caller's code, the capatization of the
80 returned fields is standardized to the preferred, although the
81 match is case- insensitive as required by the RFC. The territory in
82 returned in capitals (ISO3166), the language is lower-case
83 (ISO639), the script as upper-case first, the character-set as
84 lower-case, and the modifier and variant unchanged.
85
86 In LIST context, four elements are returned: language, territory,
87 character-set (codeset), and modifier. Those four are important
88 for the usual unix translationg infrastructure. Only the "country"
89 is obligatory, the others can be "undef". It may also return "C"
90 and "POSIX".
91
92 In SCALAR context, a HASH is returned which can contain more
93 information: language, script, territory, variant, codeset, and
94 modifiers. The variant (RFC3066 is probably never used)
95
96 pkg2domain( $package, [$domain, $filename, $line] )
97 With $domain, $filename and $line, this registers a location where
98 the textdomain is specified. Each $package can only belong to one
99 $domain.
100
101 Without these parameters, the registered domain for the $package is
102 returned.
103
104 to_html($string)
105 [1.02] Escape HTML volatile characters.
106
107 unescape_chars(STRING)
108 Replace all backslash-something escapes by their escape character.
109 For instance, backslash-t is replaced by a tab character.
110
112 This module is part of Log-Report-Optional distribution version 1.07,
113 built on January 15, 2021. Website: http://perl.overmeer.net/CPAN/
114
116 Copyrights 2013-2021 by [Mark Overmeer <mark@overmeer.net>]. For other
117 contributors see ChangeLog.
118
119 This program is free software; you can redistribute it and/or modify it
120 under the same terms as Perl itself. See http://dev.perl.org/licenses/
121
122
123
124perl v5.34.0 2021-07-22 Log::Report::Util(3)