.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.28) .\" .\" 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 turned on, 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 "CipUX 3pm" .TH CipUX 3pm "2015-07-23" "perl v5.20.2" "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" CipUX \- Common CipUX functions .SH "VERSION" .IX Header "VERSION" version 3.4.0.13 .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& use CipUX; \& \& my $cipux = $CipUX\->new(); \& \& my $max = $cipux\->max(5,6); .Ve .PP Or use as base class: .PP .Vb 1 \& use base(CipUX); \& \& my $max = $self\->max(5,6); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" Provides functions common to all CipUX classes and scripts. .SH "CONSTRUCTOR" .IX Header "CONSTRUCTOR" .SS "new" .IX Subsection "new" Constructor .PP .Vb 1 \& my $cipux = CipUX\->new(); .Ve .SH "SUBROUTINES/METHODS" .IX Header "SUBROUTINES/METHODS" The following functions will be exported by CipUX. .SS "get_linewidth" .IX Subsection "get_linewidth" Returns the CipUX line width. .SS "perr" .IX Subsection "perr" Prints an exception that variable name \s-1VARNAME\s0 was not used in subroutine \s-1API.\s0 This is used to discover internal programming errors. .PP .Vb 2 \& $cipux\->perr(\*(Aq\*(Aq); \& $cipux\->perr(\*(Aq\*(Aq,\*(Aq\*(Aq); .Ve .PP Example: .PP .Vb 2 \& $cipux\->perr(\*(Aqparameter_x\*(Aq); \& $cipux\->perr(\*(Aqparameter_x\*(Aq, 98); .Ve .SS "exc" .IX Subsection "exc" Prints a CipUX default exception on \s-1STDERR\s0 and exits. .PP .Vb 1 \& $self\->exc({nr=>$nr, value=>$value, msg=>$msg }); .Ve .SS "config" .IX Subsection "config" Central function to retrieve config space. .PP .Vb 1 \& my ($x_hr, $y_hr, $z_hr) = $self\->config({config_ar=>$config_ar}); .Ve .PP Local <\s-1NAME\s0>_config subroutine should be use to fill \f(CW$config_ar\fR .PP .Vb 1 \& Example: \& \& sub task_config { \& my $config_ar = []; \& push @{$config_ar}, \*(Aq/home/dummmy/cipux\-task.conf\*(Aq; \& my ($x_hr, $y_hr, $z_hr) = \& $self\->config({config_ar=>$config_ar}); \& return ($x_hr, $y_hr, $z_hr); \& } .Ve .SS "source" .IX Subsection "source" Incorporates a config file. .SS "store_mattrvalue" .IX Subsection "store_mattrvalue" Helper function for multiple getopt parameter with values. .SS "store_attrvalue" .IX Subsection "store_attrvalue" Helper function for single getopt parameter with value. .SS "homedir" .IX Subsection "homedir" This is an auxiliary method replacing ~ with \f(CW$ENV\fR{\s-1HGOME\s0}. .PP \&\fBSyntax:\fR .PP .Vb 1 \& my $file1 = $common\->homedir($file2); .Ve .PP \&\fBExample:\fR .PP .Vb 3 \& if $file1 = ~/.cipux/cipux\-object.conf \& and $ENV{HOME} = /root \& then file2 = /root/.cipux/cipux\-object.conf .Ve .SS "lf" .IX Subsection "lf" Laundering \s-1LDAP\s0 filter. .SS "lp" .IX Subsection "lp" Laundering passwords. .SS "li" .IX Subsection "li" Laundering integer values. .SS "l" .IX Subsection "l" Laundering of a scalar .PP .Vb 1 \& my $scalar = $self\->l($input); .Ve .SS "h" .IX Subsection "h" Check if type is hash or hash reference. .PP .Vb 1 \& my $hash_hr = $self\->a($input_hr); .Ve .SS "a" .IX Subsection "a" Check if type is array or array reference. .PP .Vb 1 \& my $array_ar = $self\->a($input_ar); .Ve .SS "test_cli_option" .IX Subsection "test_cli_option" Executes some basic test on command line option regarding a hash. .SS "date_time" .IX Subsection "date_time" returns date time format of today .SS "latin1_to_utf8" .IX Subsection "latin1_to_utf8" Converts latin to \s-1UTF\-8\s0 encoding. .SS "login_prompt" .IX Subsection "login_prompt" Prints a login prompt on \s-1STDOUT.\s0 .SS "password_prompt" .IX Subsection "password_prompt" Prints a password prompt on \s-1STDOUT.\s0 .SS "random_password" .IX Subsection "random_password" Calculates and returns a relatively random password. .SS "hash_password" .IX Subsection "hash_password" Calculates and returns a hashed password. .SS "min" .IX Subsection "min" Calculate the minimum of two integer values. .SS "max" .IX Subsection "max" Calculate the maximum of two integer values. .SS "out" .IX Subsection "out" Prints content to \s-1STDOUT.\s0 .SS "_merge_array" .IX Subsection "_merge_array" Helper subroutine for _hash_merge_setup. It uses Array::Unique to return a merged unique array reference. .SS "_hash_merge_setup" .IX Subsection "_hash_merge_setup" Perform setup for Hash::Merge. The main change is that Arrays are also merged with uniq values. .SS "cfg_ext" .IX Subsection "cfg_ext" Gets all supported extensions from Config::Any and remove non supported extensions. .SS "cfg" .IX Subsection "cfg" Query the CipUX config space to load configuration in various formats. .PP .Vb 1 \& 0. Set cfgbase to "cipux" (+ "\-$submodule" if not core module) \& \& 1. Set cfgpaths to...: \& 1. /usr/share/cipux/etc/$cfgbase.$ext \& 2. /usr/share/cipux/etc/$cfgbase.d/*.$ext \& 3. /etc/cipux/$cfgbase.$ext \& 4. /etc/cipux/$cfgbase.d/*.$ext \& 5. ~/.cipux/$cfgbase.$ext \& \& 2. Possible $ext are: cnf .conf .json .jsn .xml .yml .yaml .ini .pl .perl \& \& #3. Optionally parse and validate uppercase "$cfgbase_cfg" environment \& variable [fail if validation fails] \& \& #4. Optionally parse and validate "cfg" commandline option \& [fail if validation fails] \& \& 5. Resolve configfile list as cfgpaths, with "$cfgbase_cfg" and "cfg" appended \& if there \& \& 6. Resolve bootstrap file through parsing and validating "bootstrap" option \& from all available files in cfgpaths, later declaration overriding earlier \& ones \& \& 7. Resolve all options through executing bootstrap file \& \& #8. Optionally override subset of options through parsing and validating \& environment variables starting with uppercase "$cfgbase_" \& [fail if any validation fails] \& \& 9. Optionally override subset of options through parsing and validating all \& options from all available files in cfgpaths [fail if any validation fails] .Ve .PP Notes about the above: .PP .Vb 1 \& * Number with leading "#" are not implemented. \& \& * config files are "layered", allowing overrides. Personal configfile \& is included last, not first, and more locations are supported. \& \& #* (subset of) options can be provided through ENV \& \& #* commandline and environment options are validated as part of parsing .Ve .PP Recommendation: .PP Even if several formats are supported, that does not mean they are all suited for this task. .PP .Vb 2 \& * Some configuration formats for example are too simple to express the complex \& cipux\-task.perl configuration. \& \& * The CPAN Perl modules used for this configuration space are rather young \& Config::Any 2006 \- 2009, Hash::Merge 2001 \- 2009 and not every \& configuration file type mixture was tested. As a recommendation, you should \& not mix to many files and formats. .Ve .SS "create_cache_dir_if_not_present" .IX Subsection "create_cache_dir_if_not_present" Creates a directory 'cipux' under /var/cache if not present. This is used to store serialized objects. .SS "iterate_config_space" .IX Subsection "iterate_config_space" Takes a single config file \f(CW$cfg\fR (can be undef, but must be present) and a string representing the configuration base \f(CW$cfgbase\fR. It will then just use \f(CW$cfg\fR or it will find out regarding to \f(CW$cfgbase\fR what files should be considered. .PP .Vb 6 \& my $loadcfg_ar = $self\->iterate_config_space( \& { \& cfg => $cfg, \& cfgbase => $cfgbase, \& } \& ); .Ve .PP returns a list of all configuration files which should be evaluated. .SS "evaluate_config_space" .IX Subsection "evaluate_config_space" Takes a araay ref to a list of configuration files \f(CW$loadcfg_ar\fR, preferably cunstructed by iterate_config_space. It also taks a string \f(CW$cache_dir\fR to the temporary location of a cache_dir. This value can be empty but not undef and has to be provided. It also require the \f(CW$cfgbase\fR string, the \*(L"domain\*(R" of the configuration. .PP It will calculate for every config file the MD5sum for later comparison. .PP .Vb 7 \& my $clean = $self\->evaluate_config_space( \& { \& loadcfg_ar => $loadcfg_ar, \& cache_dir => $cache_dir, \& cfgbase => $cfgbase, \& } \& ); .Ve .PP It will return 0 if changed files are found and 1 if no changed files are found. .SH "DIAGNOSTICS" .IX Header "DIAGNOSTICS" This module generates the following exceptions: .PP \&\s-1TODO\s0 .SH "CONFIGURATION AND ENVIRONMENT" .IX Header "CONFIGURATION AND ENVIRONMENT" Not applicable. .SH "DEPENDENCIES" .IX Header "DEPENDENCIES" .Vb 10 \& Array::Unique \& Carp \& Class::Std \& Config::Any \& Data::Dumper \& Date::Manip \& English \& File::Basename \& File::Glob \& File::Path \& Hash::Merge \& Log::Log4perl \& Pod::Usage \& Readonly \& Storable \& Term::ReadKey \& Unicode::String \& version .Ve .SH "INCOMPATIBILITIES" .IX Header "INCOMPATIBILITIES" Not known. .SH "BUGS AND LIMITATIONS" .IX Header "BUGS AND LIMITATIONS" Not known. .SH "SEE ALSO" .IX Header "SEE ALSO" See the CipUX web page and the manual at .PP See the mailing list .SH "AUTHOR" .IX Header "AUTHOR" Christian Kuelker .SH "LICENSE AND COPYRIGHT" .IX Header "LICENSE AND COPYRIGHT" Copyright (C) 2007 \- 2009 by Christian Kuelker .PP This program is free software; you can redistribute it and/or modify it under the terms of the \s-1GNU\s0 General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. .PP This program is distributed in the hope that it will be useful, but \&\s-1WITHOUT ANY WARRANTY\s0; without even the implied warranty of \&\s-1MERCHANTABILITY\s0 or \s-1FITNESS FOR A PARTICULAR PURPOSE. \s0 See the \s-1GNU\s0 General Public License for more details. .PP You should have received a copy of the \s-1GNU\s0 General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, \s-1MA 02111\-1307 USA\s0