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 REASONS = BLOCK [ ',' BLOCKS]
30 BLOCK = '-' TO | FROM '-' TO | ONE | SOURCE
31 FROM,TO,ONE = 'TRACE' | 'ASSERT' | ,,, | 'PANIC'
32 SOURCE = 'USER' | 'PROGRAM' | 'SYSTEM' | 'ALL'
33
34 The SOURCE specification group all reasons which are usually
35 related to the problem: report about problems caused by the user,
36 reported by the program, or with system interaction.
37
38 example: of expended REASONS
39
40 WARNING-FAULT # == WARNING,MISTAKE,ERROR,FAULT
41 -INFO # == TRACE-INFO
42 ALERT- # == ALERT,FAILURE,PANIC
43 USER # == MISTAKE,ERROR
44 ALL # == TRACE-PANIC
45
46 is_fatal($reason)
47 Returns true if the $reason is severe enough to cause an exception
48 (or program termination).
49
50 is_reason($name)
51 Returns true if the STRING is one of the predefined REASONS.
52
53 use_errno($reason)
54
55 Modes
56 Run-modes are explained in Log::Report::Dispatcher.
57
58 mode_accepts($mode)
59 Returns something acceptable by expand_reasons()
60
61 mode_number($name|$mode)
62 Returns the $mode as number.
63
64 must_show_location($mode, $reason)
65 must_show_stack($mode, $reason)
66
67 Other
68 escape_chars(STRING)
69 Replace all escape characters into their readable counterpart. For
70 instance, a new-line is replaced by backslash-n.
71
72 parse_locale(STRING)
73 Decompose a locale string.
74
75 For simplicity of the caller's code, the capatization of the
76 returned fields is standardized to the preferred, although the
77 match is case- insensitive as required by the RFC. The territory in
78 returned in capitals (ISO3166), the language is lower-case
79 (ISO639), the script as upper-case first, the character-set as
80 lower-case, and the modifier and variant unchanged.
81
82 In LIST context, four elements are returned: language, territory,
83 character-set (codeset), and modifier. Those four are important
84 for the usual unix translationg infrastructure. Only the "country"
85 is obligatory, the others can be "undef". It may also return "C"
86 and "POSIX".
87
88 In SCALAR context, a HASH is returned which can contain more
89 information: language, script, territory, variant, codeset, and
90 modifiers. The variant (RFC3066 is probably never used)
91
92 pkg2domain( $package, [$domain, $filename, $line] )
93 With $domain, $filename and $line, this registers a location where
94 the textdomain is specified. Each $package can only belong to one
95 $domain.
96
97 Without these parameters, the registered domain for the $package is
98 returned.
99
100 to_html($string)
101 [1.02] Escape HTML volatile characters.
102
103 unescape_chars(STRING)
104 Replace all backslash-something escapes by their escape character.
105 For instance, backslash-t is replaced by a tab character.
106
108 This module is part of Log-Report-Optional distribution version 1.06,
109 built on February 02, 2018. Website: http://perl.overmeer.net/CPAN/
110
112 Copyrights 2013-2018 by [Mark Overmeer <mark@overmeer.net>]. For other
113 contributors see ChangeLog.
114
115 This program is free software; you can redistribute it and/or modify it
116 under the same terms as Perl itself. See http://dev.perl.org/licenses/
117
118
119
120perl v5.28.1 2018-02-02 Log::Report::Util(3)