.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "App::CELL 3pm" .TH App::CELL 3pm "2022-07-17" "perl v5.34.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" App::CELL \- Configuration, Error\-handling, Localization, and Logging .SH "VERSION" .IX Header "VERSION" Version 0.231 .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& # imagine you have a script/app called \*(Aqfoo\*(Aq . . . \& \& use Log::Any::Adapter ( \*(AqFile\*(Aq, "/var/tmp/foo.log" ); \& use App::CELL qw( $CELL $log $meta $site ); \& \& # load config params and messages from sitedir \& my $status = $CELL\->load( sitedir => \*(Aq/etc/foo\*(Aq ); \& return $status unless $status\->ok; \& \& # set appname to FOO_APPNAME (a config param just loaded from sitedir) \& $CELL\->appname( $CELL\->FOO_APPNAME || "foo" ); \& \& # write to the log \& $log\->notice("Configuration loaded from /etc/foo"); \& \& # get value of site configuration parameter FOO_PARAM \& my $val = $site\->FOO_PARAM; \& \& # get a list of all supported languages \& my @supp_lang = $CELL\->supported_languages; \& \& # determine if a language is supported \& print "sk supported" if $CELL\->language_supported(\*(Aqsk\*(Aq); \& \& # get message object and text in default language \& $status = $CELL\->msg(\*(AqFOO_INFO_MSG\*(Aq); \& my $fmsg = $status\->payload if $status\->ok; \& my $text = $fmsg\->text; \& \& # get message object and text in default language \& # (message that takes arguments) \& $fmsg = $CELL\->msg(\*(AqBAR_ARGS_MSG\*(Aq, "arg1", "arg2"); \& print $fmsg\->text, "\en"; \& \& # get text of message in a different language \& my $sk_text = $fmsg\->lang(\*(Aqsk\*(Aq)\->text; .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" This is the top-level module of App::CELL, the Configuration, Error-handling, Localization, and Logging framework for applications (or scripts) written in Perl. .PP For details, read the \s-1POD\s0 in the App::CELL distro. For an introduction, read App::CELL::Guide. .SH "EXPORTS" .IX Header "EXPORTS" This module provides the following exports: .ie n .IP "$CELL \- App::CELL singleton object" 4 .el .IP "\f(CW$CELL\fR \- App::CELL singleton object" 4 .IX Item "$CELL - App::CELL singleton object" .PD 0 .ie n .IP "$log \- App::CELL::Log singleton object" 4 .el .IP "\f(CW$log\fR \- App::CELL::Log singleton object" 4 .IX Item "$log - App::CELL::Log singleton object" .ie n .IP "$meta \- App::CELL::Config singleton object" 4 .el .IP "\f(CW$meta\fR \- App::CELL::Config singleton object" 4 .IX Item "$meta - App::CELL::Config singleton object" .ie n .IP "$core \- App::CELL::Config singleton object" 4 .el .IP "\f(CW$core\fR \- App::CELL::Config singleton object" 4 .IX Item "$core - App::CELL::Config singleton object" .ie n .IP "$site \- App::CELL::Config singleton object" 4 .el .IP "\f(CW$site\fR \- App::CELL::Config singleton object" 4 .IX Item "$site - App::CELL::Config singleton object" .PD .SH "METHODS" .IX Header "METHODS" .SS "appname" .IX Subsection "appname" If no argument is given, returns the \f(CW\*(C`appname\*(C'\fR \*(-- i.e. the name of the application or script that is using App::CELL for its configuration, error handling, etc. .PP If an argument is given, assumes that it denotes the desired \f(CW\*(C`appname\*(C'\fR and sets it. Also initializes the logger. .SS "enviro" .IX Subsection "enviro" Get the \f(CW\*(C`enviro\*(C'\fR attribute, i.e. the name of the environment variable containing the sitedir .SS "loaded" .IX Subsection "loaded" Get the current load status, which can be any of the following: 0 nothing loaded yet '\s-1SHARE\s0' sharedir loaded '\s-1BOTH\s0' sharedir _and_ sitedir loaded .SS "sharedir" .IX Subsection "sharedir" Get the \f(CW\*(C`sharedir\*(C'\fR attribute, i.e. the full path of the site configuration directory (available only after sharedir has been successfully loaded) .SS "sitedir" .IX Subsection "sitedir" Get the \f(CW\*(C`sitedir\*(C'\fR attribute, i.e. the full path of the site configuration directory (available only after sitedir has been successfully loaded) .SS "supported_languages" .IX Subsection "supported_languages" Get list of supported languages. Equivalent to: .PP .Vb 1 \& $site\->CELL_SUPP_LANG || [ \*(Aqen ] .Ve .SS "language_supported" .IX Subsection "language_supported" Determine if a given language is supported. .ie n .SS """load""" .el .SS "\f(CWload\fP" .IX Subsection "load" Attempt to load messages and configuration parameters from the sharedir and, possibly, the sitedir as well. .PP Takes: a \s-1PARAMHASH\s0 that should include at least one of \f(CW\*(C`enviro\*(C'\fR or \&\f(CW\*(C`sitedir\*(C'\fR (if both are given, \f(CW\*(C`enviro\*(C'\fR takes precedence with \f(CW\*(C`sitedir\*(C'\fR as a fallback). The \s-1PARAMHASH\s0 can also include a \f(CW\*(C`verbose\*(C'\fR parameter which, when set to a true value, causes the load routine to log more verbosely. .PP Returns: an \f(CW\*(C`App::CELL::Status\*(C'\fR object, which could be any of the following: \s-1OK\s0 success \s-1WARN\s0 previous call already succeeded, nothing to do \s-1ERR\s0 failure .PP On success, it also sets the \f(CW\*(C`CELL_META_START_DATETIME\*(C'\fR meta parameter. .SS "Status constructors" .IX Subsection "Status constructors" The following \*(L"factory\*(R" makes a bunch of status constructor methods (wrappers for App::CELL::Status\->new ) .PP \fIstatus_crit\fR .IX Subsection "status_crit" .PP Constructor for '\s-1CRIT\s0' status objects .PP \fIstatus_critical\fR .IX Subsection "status_critical" .PP Constructor for '\s-1CRIT\s0' status objects .PP \fIstatus_debug\fR .IX Subsection "status_debug" .PP Constructor for '\s-1DEBUG\s0' status objects .PP \fIstatus_emergency\fR .IX Subsection "status_emergency" .PP Constructor for '\s-1DEBUG\s0' status objects .PP \fIstatus_err\fR .IX Subsection "status_err" .PP Constructor for '\s-1ERR\s0' status objects .PP \fIstatus_error\fR .IX Subsection "status_error" .PP Constructor for '\s-1ERR\s0' status objects .PP \fIstatus_fatal\fR .IX Subsection "status_fatal" .PP Constructor for '\s-1FATAL\s0' status objects .PP \fIstatus_info\fR .IX Subsection "status_info" .PP Constructor for '\s-1INFO\s0' status objects .PP \fIstatus_inform\fR .IX Subsection "status_inform" .PP Constructor for '\s-1INFORM\s0' status objects .PP \fIstatus_not_ok\fR .IX Subsection "status_not_ok" .PP Constructor for '\s-1NOT_OK\s0' status objects .PP \fIstatus_notice\fR .IX Subsection "status_notice" .PP Constructor for '\s-1NOTICE\s0' status objects .PP \fIstatus_ok\fR .IX Subsection "status_ok" .PP Constructor for '\s-1OK\s0' status objects .PP \fIstatus_trace\fR .IX Subsection "status_trace" .PP Constructor for '\s-1TRACE\s0' status objects .PP \fIstatus_warn\fR .IX Subsection "status_warn" .PP Constructor for '\s-1WARN\s0' status objects .PP \fIstatus_warning\fR .IX Subsection "status_warning" .PP Constructor for '\s-1WARNING\s0' status objects .SS "msg" .IX Subsection "msg" Construct a message object (wrapper for App::CELL::Message::new) .SH "LICENSE AND COPYRIGHT" .IX Header "LICENSE AND COPYRIGHT" Copyright (c) 2014\-2020, \s-1SUSE LLC\s0 .PP All rights reserved. .PP Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: .PP 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. .PP 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. .PP 3. Neither the name of \s-1SUSE LLC\s0 nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. .PP \&\s-1THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \*(L"AS IS\*(R" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\s0 (\s-1INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES\s0; \s-1LOSS OF USE, DATA, OR PROFITS\s0; \s-1OR BUSINESS INTERRUPTION\s0) \s-1HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\s0 (\s-1INCLUDING NEGLIGENCE OR OTHERWISE\s0) \&\s-1ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\s0