| 1 | package EAI::Common 1.921; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 3 | ▶ | use strict; use feature 'unicode_strings'; use warnings; no warnings 'uninitialized'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 3 | ▶ | use Exporter qw(import); use EAI::DateUtil; use Data::Dumper qw(Dumper); use Getopt::Long qw(:config no_ignore_case); use Log::Log4perl qw(get_logger); use MIME::Lite (); use Scalar::Util qw(looks_like_number); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 3 | ▶ | use Carp qw(confess longmess); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | # to make use of colored logs with Log::Log4perl::Appender::ScreenColoredLevels on windows we have to use that (special "use" to make this optional on non-win environments) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 3 | ▶ | BEGIN { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=2 SCAR=10.5
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 0 | ▶ | if ($^O =~ /MSWin/) {require Win32::Console::ANSI; Win32::Console::ANSI->import();} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 3 | our @EXPORT = qw($EAI_WRAP_CONFIG_PATH $EAI_WRAP_SENS_CONFIG_PATH %common %config %execute @loads @optload %opt readConfigFile getSensInfo setupConfigMerge getOptions setupEAIWrap dumpFlat extractConfigs checkHash checkParam getLogFPathForMail getLogFPath MailFilter setErrSubject setupLogging checkStartingCond sendGeneralMail looks_like_number get_logger); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | my %hashCheck = ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | common => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | DB => {}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | File => {}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | FTP => {}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | process => {}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | task => {}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | config => { # parameter category for site global settings, usually defined in site.config and other associated configs loaded at INIT | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | checkLogExistDelay => {}, # ref to following hash: {Test => 2, Dev => 3, "" => 0}, mapping to set delays for checkLogExist per environment in $execute{env}, this can be further overriden per job (and environment) in checkLookup. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | checkLookup => {}, # ref to following datastructure: {"scriptname.pl + optional addToScriptName" => {errmailaddress => "",errmailsubject => "",timeToCheck =>"", freqToCheck => "", logFileToCheck => "", logcheck => "",logRootPath =>""},...} used for logchecker, each entry of the hash lookup table defines a log to be checked, defining errmailaddress to receive error mails, errmailsubject, timeToCheck as earliest time to check for existence in log, freqToCheck as frequency of checks (daily/monthly/etc), logFileToCheck as the name of the logfile to check, logcheck as the regex to check in the logfile and logRootPath as the folder where the logfile is found. lookup key: $execute{scriptname} + $execute{addToScriptName} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | errmailaddress => "", # default mail address for central logcheck/errmail sending | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | errmailsubject => "", # default mail subject for central logcheck/errmail sending | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | executeOnInit => "", # code to be executed during INIT of EAI::Wrap to allow for assignment of config/execute parameters from commandline params BEFORE Logging! | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | folderEnvironmentMapping => {}, # ref to hash {Test => "Test", Dev => "Dev", "" => "Prod"}, mapping for $execute{envraw} to $execute{env} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | fromaddress => "", # from address for central logcheck/errmail sending, also used as default sender address for sendGeneralMail | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | historyFolder => {}, # ref to following hash: {"scriptname.pl + optional addToScriptName" => "folder"}, folders where downloaded files are historized, lookup key as in checkLookup, default in "" => "defaultfolder". historyFolder, historyFolderUpload, logRootPath and redoDir are always built with an environment subfolder, the default is built as folderPath/endFolder/environ, otherwise it is built as folderPath/environ/endFolder. Environment subfolders (environ) are also built depending on prodEnvironmentInSeparatePath: either folderPath/endFolder/$execute{env} (prodEnvironmentInSeparatePath = true, Prod has own subfolder) or folderPath/endFolder/$execute{envraw} (prodEnvironmentInSeparatePath = false, Prod is in common folder, other environments have their own folder) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | historyFolderUpload => {}, # ref to following hash: {"scriptname.pl + optional addToScriptName" => "folder"}, folders where uploaded files are historized, lookup key as in checkLookup, default in "" => "defaultfolder" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | logCheckHoliday => "", # calendar for business days in central logcheck/errmail sending. builtin calendars are AT (Austria), TG (Target), UK (United Kingdom) and WE (for only weekends). Calendars can be added with EAI::DateUtil::addCalendar | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | logs_to_be_ignored_in_nonprod => qr//, # regular expression to specify logs to be ignored in central logcheck/errmail sending | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 0 | ▶ | logprefixForLastLogfile => sub {}, # prefix for previous (day) logs to be set in error mail (link), if not given, defaults to get_curdate(). In case Log::Dispatch::FileRotate is used as the File Appender in Log4perl config, the previous log is identified with <logname>.1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 3 | logRootPath => {}, # ref to following hash: {"scriptname.pl + optional addToScriptName" => "folder"}, paths to log file root folders (environment is added to that if non production), lookup key as checkLookup, default in "" => "defaultfolder" | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | prodEnvironmentInSeparatePath => 1, # set to 1 if the production scripts/logs etc. are in a separate Path defined by folderEnvironmentMapping (prod=root/Prod, test=root/Test, etc.), set to 0 if the production scripts/logs are in the root folder and all other environments are below that folder (prod=root, test=root/Test, etc.) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | redoDir => {}, # ref to following hash: {"scriptname.pl + optional addToScriptName" => "folder"}, folders where files for redo are contained, lookup key as checkLookup, default in "" => "defaultfolder" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | sensitive => {}, # hash lookup table: {"prefix" => {user=>"",pwd =>"",hostkey=>"",privkey =>""},...} for sensitive access information in DB and FTP (lookup keys are set with DB{prefix} or FTP{prefix}), may also be placed outside of site.config; all sensitive keys can also be environment lookups, e.g. hostkey=>{Test => "", Prod => ""} to allow for environment specific setting | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | smtpServer => "", # smtp server for den (error) mail sending | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | smtpTimeout => 60, # timeout for smtp response | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | testerrmailaddress => '', # error mail address in non prod environment | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | DB => {}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | File => {}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | FTP => {}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | process => {}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | task => {}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | execute => { # hash of parameters for current task execution. This is not to be set by the user, but can be used to as information to set other parameters and control the flow | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | addToScriptName => "", # this can be set to be added to the scriptname for config{checkLookup} keys, e.g. some passed parameter. This is typically done in config{executeOnInit} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | env => "", # Prod, Test, Dev, whatever is defined as the lookup value in folderEnvironmentMapping. homedir as fetched from the File::basename::dirname of the executing script using /^.*[\\\/](.*?)$/ is used as the key for looking up this value. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | envraw => "", # Production has a special significance here as being an empty string. Otherwise like env. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | errmailaddress => "", # target address for central logcheck/errmail sending in current process | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | errmailsubject => "", # mail subject for central logcheck/errmail sending in current process | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | failcount => 1, # for counting failures in processing to switch to longer wait period or finish altogether | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | filesToDelete => [], # list of files to be deleted locally after download, necessary for cleanup at the end of the process | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | filesUploadedToDelete => [], # list of files to be deleted locally after upload, necessary for cleanup at the end of the process | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | filesToMoveinHistory => [], # list of files to be moved in historyFolder locally, necessary for cleanup at the end of the process | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | filesToMoveinHistoryUpload => [], # list of files to be moved in historyFolderUpload locally, necessary for cleanup at the end of the process | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | firstRunSuccess => 1, # for planned retries (process=>plannedUntil filled) -> this is set after the first run to avoid error messages resulting of files having been moved/removed. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | freqToCheck => "", # for logchecker: frequency to check entries (B,D,M,M1) ... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | homedir => "", # the home folder of the script, mostly used to return from redo and other folders for globbing files. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | historyFolder => "", # actually set historyFolder | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | historyFolderUpload => "", # actually set historyFolderUpload | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | logcheck => "", # for logchecker: the Logcheck (regex) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | logFileToCheck => "", # for logchecker: Logfile to be searched | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | logRootPath => "", # actually set logRootPath | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | processEnd => 1, # specifies that the process is ended, checked in EAI::Wrap::processingEnd | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | redoDir => "", # actually set redoDir | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | retryBecauseOfError => 1, # retryBecauseOfError shows if a rerun occurs due to errors (for successMail) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | retrySeconds => 60, # how many seconds are passed between retries. This is set on error with process=>retrySecondsErr and if planned retry is defined with process=>retrySecondsPlanned | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | scriptname => "", # name of the current process script, also used in log/history setup together with addToScriptName for config{checkLookup} keys | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | startingTime => "", # tasks starting time for checking task{retryEndsAfterMidnight} against current time | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | timeToCheck => "", # for logchecker: scheduled time of job (don't look earlier for log entries) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | load => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | DB => {}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | File => {}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | FTP => {}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | process => {}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | DB => { # DB specific configs | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | addID => {}, # this hash can be used to additionaly set a constant to given fields: Fieldname => Fieldvalue | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | additionalLookup => "", # query used in getAdditionalDBData to retrieve lookup information from DB using EAI::DB::readFromDBHash | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | additionalLookupKeys => [], # used for getAdditionalDBData, list of field names to be used as the keys of the returned hash | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | cutoffYr2000 => 60, # when storing date data with 2 year digits in dumpDataIntoDB/EAI::DB::storeInDB, this is the cutoff where years are interpreted as 19XX (> cutoffYr2000) or 20XX (<= cutoffYr2000) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | columnnames => [], # returned column names from EAI::DB::readFromDB and EAI::DB::readFromDBHash, this is used in writeFileFromDB to pass column information from database to writeText | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | database => "", # database to be used for connecting | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | debugKeyIndicator => "", # used in dumpDataIntoDB/EAI::DB::storeInDB as an indicator for keys for debugging information if primkey not given (errors are shown with this key information). Format is the same as for primkey | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | deleteBeforeInsertSelector => "", # used in dumpDataIntoDB/EAI::DB::storeInDB to delete specific data defined by keydata before an insert (first occurrence in data is used for key values). Format is the same as for primkey ("key1 = ? ...") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | dontWarnOnNotExistingFields => 0, # suppress warnings in dumpDataIntoDB/EAI::DB::storeInDB for not existing fields | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | dontKeepContent => 1, # if table should be completely cleared before inserting data in dumpDataIntoDB/EAI::DB::storeInDB | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | doUpdateBeforeInsert => 1, # invert insert/update sequence in dumpDataIntoDB/EAI::DB::storeInDB, insert only done when upsert flag is set | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | DSN => '', # DSN String for DB connection | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | incrementalStore => 1, # when storing data with dumpDataIntoDB/EAI::DB::storeInDB, avoid setting empty columns to NULL | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | ignoreDuplicateErrs => 1, # ignore any duplicate errors in dumpDataIntoDB/EAI::DB::storeInDB | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | keyfields => [], # used for EAI::DB::readFromDBHash, list of field names to be used as the keys of the returned hash | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | longreadlen => 1024, # used for setting database handles LongReadLen parameter for DB connection, if not set defaults to 1024 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | lookups => {}, # similar to $config{sensitive}, a hash lookup table ({"prefix" => {remoteHost=>""},...} or {"prefix" => {remoteHost=>{Prod => "", Test => ""}},...}) for centrally looking up DSN Settings depending on $DB{prefix}. Overrides $DB{DSN} set in config, but is overriden by script-level settings in %common. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | noDBTransaction => 1, # don't use a DB transaction for dumpDataIntoDB | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | noDumpIntoDB => 1, # if files from this load should not be dumped to the database | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | port => {}, # port to be added to server in environment hash lookup: {Prod => "", Test => ""} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | postDumpExecs => [], # array for DB executions done in dumpDataIntoDB after postDumpProcessing and before commit/rollback: [{execs => ['',''], condition => ''}]. For all execs a doInDB is executed if condition (evaluated string or anonymous sub: condition => sub {...}) is fulfilled | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | postDumpProcessing => "", # done in dumpDataIntoDB after EAI::DB::storeInDB, execute perl code in postDumpProcessing (evaluated string or anonymous sub: postDumpProcessing => sub {...}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | postReadProcessing => "", # done in writeFileFromDB after EAI::DB::readFromDB, execute perl code in postReadProcessing (evaluated string or anonymous sub: postReadProcessing => sub {...}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | prefix => "", # key for sensitive information (e.g. pwd and user) in config{sensitive} or system wide DSN in config{DB}{prefix}{DSN}. respects environment in $execute{env} if configured. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | primkey => "", # primary key indicator to be used for update statements, format: "key1 = ? AND key2 = ? ...". Not necessary for dumpDataIntoDB/storeInDB if dontKeepContent is set to 1, here the whole table content is removed before storing | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | pwd => "", # for password setting, either directly (insecure -> visible) or via sensitive lookup | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | query => "", # query statement used for EAI::DB::readFromDB and EAI::DB::readFromDBHash | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | schemaName => "", # schemaName used in dumpDataIntoDB/EAI::DB::storeInDB, if tableName contains dot the extracted schema from tableName overrides this. Needed for datatype information! | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | server => {}, # DB Server in environment hash lookup: {Prod => "", Test => ""} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | tablename => "", # the table where data is stored in dumpDataIntoDB/EAI::DB::storeInDB | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | upsert => 1, # in dumpDataIntoDB/EAI::DB::storeInDB, should both update and insert be done. doUpdateBeforeInsert=0: after the insert failed (because of duplicate keys) or doUpdateBeforeInsert=1: insert after the update failed (because of key not exists)? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | user => "", # for setting username in db connection, either directly (insecure -> visible) or via sensitive lookup | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | File => { # File fetching and parsing specific configs. File{filename} is also used for FTP | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | avoidRenameForRedo => 1, # when redoing, usually the cutoff (datetime/redo info) is removed following a pattern. set this flag to avoid this | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | append => 0, # for EAI::File::writeText: boolean to append (1) or overwrite (0 or undefined) to file given in filename | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | columns => {}, # for EAI::File::writeText: Hash of data fields, that are to be written (in order of keys) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | columnskip => {}, # for EAI::File::writeText: boolean hash of column names that should be skipped when writing the file ({column1ToSkip => 1, column2ToSkip => 1, ...}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | dontKeepHistory => 1, # if up- or downloaded file should not be moved into historyFolder but be deleted | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | dontMoveIntoHistory => 1, # if up- or downloaded file should not be moved into historyFolder but be kept in homedir | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | emptyOK => 0, # flag to specify whether empty files should not invoke an error message. Also needed to mark an empty file as processed in EAI::Wrap::markProcessed | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | extract => 1, # flag to specify whether to extract files from archive package (zip) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | extension => "", # the extension of the file to be read (optional, used for redoFile) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | fieldCode => {}, # additional field based processing code: fieldCode => {field1 => 'perl code', ..}, invoked if key equals either header (as in format_header) or targetheader (as in format_targetheader) or invoked for all fields if key is empty {"" => 'perl code'}. set $EAI::File::skipLineAssignment to true (1) if current line should be skipped from data. perl code can be an evaluated string or an anonymous sub: field1 => sub {...} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | filename => "", # the name of the file to be read, can also be a glob spec to retrieve multiple files. This information is also used for FTP and retrieval and local file copying. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | firstLineProc => "", # processing done when reading the first line of text files in EAI::File::readText (used to retrieve information from a header line, like reference date etc.). The line is available in $_. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | format_allowLinefeedInData => 1, # line feeds in values don't create artificial new lines/records, only works for csv quoted data in EAI::File::readText | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | format_autoheader => 1, # assumption: header exists in file and format_header should be derived from there. only for EAI::File::readText | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | format_beforeHeader => "", # additional String to be written before the header in EAI::File::writeText | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | format_dateColumns => [], # numeric array of columns that contain date values (special parsing) in excel files (EAI::File::readExcel) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | format_decimalsep => "", # decimal separator used in numbers of sourcefile (defaults to . if not given) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | format_defaultsep => "", # default separator when format_sep not given (usually in site.config), if no separator is given (not needed for EAI::File::readExcel/EAI::File::readXML), "\t" is used for parsing format_header and format_targetheader. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | format_encoding => "", # text encoding of the file in question (e.g. :encoding(utf8)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | format_headerColumns => [], # optional numeric array of columns that contain data in excel files (defaults to all columns starting with first column up to format_targetheader length) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | format_header => "", # format_sep separated string containing header fields (optional in excel files, only used to check against existing header row) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | format_headerskip => 1, # skip until row-number for checking header row against format_header in EAI::File::readExcel | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | format_eol => "", # for quoted csv specify special eol character (allowing newlines in values) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | format_fieldXpath => {}, # for EAI::File::readXML, hash with field => xpath to content association entries | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | format_fix => 1, # for text writing, specify whether fixed length format should be used (requires format_padding) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | format_namespaces => {}, # for EAI::File::readXML, hash with alias => namespace association entries | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | format_padding => {}, # for text writing, hash with field number => padding to be applied for fixed length format | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | format_poslen => [], # array of array defining positions and lengths [[pos1,len1],[pos2,len2]...[posN,lenN]] of data in fixed length format text files (if format_sep == "fix") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | format_quotedcsv => 1, # special parsing/writing of quoted csv data using Text::CSV | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | format_sep => "", # separator string for EAI::File::readText and EAI::File::writeText csv formats, a regex for splitting other separated formats. If format_sep is not explicitly given as a regex here (=> qr//), then it is assumed to be a regex by split, however this causes surprising effects with regex metacharacters (should be quoted, such as qr/\|/)! Also used for splitting format_header and format_targetheader (Excel and XML-formats use tab as default separator here). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | format_sepHead => "", # special separator for header row in EAI::File::writeText, overrides format_sep | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | format_skip => "", # either numeric or string, skip until row-number if numeric or appearance of string otherwise in reading textfile. If numeric, format_skip can also be used in EAI::File::readExcel | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | format_stopOnEmptyValueColumn => 1, # for EAI::File::readExcel, stop row parsing when a cell with this column number is empty (denotes end of data, to avoid very long parsing). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | format_suppressHeader => 1, # for text and excel file writing, suppress output of header | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | format_targetheader => "", # format_sep separated string containing target header fields (= the field names in target/database table). optional for XML and tabular textfiles, defaults to format_header if not given there. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | format_thousandsep => "", # thousand separator used in numbers of sourcefile (defaults to , if not given) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | format_worksheetID => 1, # worksheet number for EAI::File::readExcel, this should always work | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | format_worksheet => "", # alternatively the worksheet name can be passed for EAI::File::readExcel, this only works for new excel format (xlsx) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | format_xlformat => "xlsx|xls", # excel format for parsing, also specifies that excel parsing should be done | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | format_xpathRecordLevel => "", # xpath for level where data nodes are located in xml | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | format_XML => 1, # specify xml parsing | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | lineCode => "", # additional line based processing code, invoked after whole line has been read (evaluated string or anonymous sub: lineCode => sub {...}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | localFilesystemPath => "", # if files are taken from or put to the local file system with getLocalFiles/putFileInLocalDir then the path is given here. Setting this to "." avoids copying files. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | optional => 1, # to avoid error message for missing optional files, set this to 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | FTP => { # FTP specific configs | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | additionalParamsGet => {}, # additional parameters for Net::SFTP::Foreign get. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | additionalMoreArgs => [], # additional more args for Net::SFTP::Foreign new (args passed to ssh command). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | additionalParamsNew => {}, # additional parameters for Net::SFTP::Foreign new (args passed to Net::SFTP::Foreign). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | additionalParamsPut => {}, # additional parameters for Net::SFTP::Foreign put. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | archiveDir => "", # folder for archived files on the FTP server | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | dateOfFetchedFile => 0, # returned date (taken from mtime/mdtm) of file fetched with fetchFiles in format YYYYMMDD, only works for single file | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | dontMoveTempImmediately => 1, # if 0 oder missing: rename/move files immediately after writing to FTP to the final name, otherwise/1: a call to EAI::FTP::moveTempFiles is required for that | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | dontDoSetStat => 1, # for Net::SFTP::Foreign, no setting of time stamp of remote file to that of local file (avoid error messages of FTP Server if it doesn't support this) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | dontDoUtime => 1, # don't set time stamp of local file to that of remote file | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | dontUseQuoteSystemForPwd => 0, # for windows, a special quoting is used for passing passwords to Net::SFTP::Foreign that contain [()"<>& . This flag can be used to disable this quoting. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | dontUseTempFile => 1, # directly upload files, without temp files | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | fileToArchive => 1, # should files be archived on FTP server? if archiveDir is not set, then file is archived (rolled) in the same folder | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | fileToRemove => 1, # should files be removed on FTP server? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | FTPdebugLevel => 0, # debug ftp: 0 or ~(1|2|4|8|16|1024|2048), loglevel automatically set to debug for module EAI::FTP | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | hostkey => "", # hostkey to present to the server for Net::SFTP::Foreign, either directly (insecure -> visible) or via sensitive lookup | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | hostkey2 => "", # additional hostkey to be presented (e.g. in case of round robin DNS) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | localDir => "", # optional: local folder for files to be placed, if not given files are downloaded into current folder | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | lookups => {}, # similar to $config{sensitive}, a hash lookup table ({"prefix" => {remoteHost=>""},...} or {"prefix" => {remoteHost=>{Prod => "", Test => ""}},...}) for centrally looking up remoteHost and port settings depending on $FTP{prefix}. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | maxConnectionTries => 5, # maximum number of tries for connecting in login procedure | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | noDirectRemoteDirChange => 1, # if no direct change into absolute paths (/some/path/to/change/into) ist possible then set this to 1, this does a separated change into setcwd(undef) and setcwd(remoteDir) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | onlyArchive => 0, # only archive/remove given files on the FTP server, requires archiveDir to be set | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | path => "", # additional relative FTP path (under remoteDir which is set at login), where the file(s) is/are located | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | port => 22, # ftp/sftp port (leave empty for default port 22 when using Net::SFTP::Foreign, or port 21 when using Net::FTP) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | prefix => "ftp", # key for sensitive information (e.g. pwd and user) in config{sensitive} or system wide remoteHost/port in config{FTP}{prefix}{remoteHost} or config{FTP}{prefix}{port}. respects environment in $execute{env} if configured. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | privKey => "", # sftp key file location for Net::SFTP::Foreign, either directly (insecure -> visible) or via sensitive lookup | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | pwd => "", # for password setting, either directly (insecure -> visible) or via sensitive lookup | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | queue_size => 1, # queue_size for Net::SFTP::Foreign, if > 1 this causes often connection issues | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | remove => {}, # ref to hash {removeFolders=>[], day=>, mon=>, year=>1} for for removing (archived) files with removeFilesOlderX, all files in removeFolders are deleted being older than day days, mon months and year years | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | remoteDir => "", # remote root folder for up-/download, archive and remove: "out/Marktdaten/", path is added then for each filename (load) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | remoteHost => {}, # ref to hash of IP-addresses/DNS of host(s). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | SFTP => 0, # to explicitly use SFTP, if not given SFTP will be derived from existence of privKey or hostkey | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | simulate => 0, # for removal of files using removeFilesinFolderOlderX/removeFilesOlderX only simulate (1) or do actually (0)? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | sshInstallationPath => "", # path were ssh/plink exe to be used by Net::SFTP::Foreign is located | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | type => "", # (A)scii or (B)inary, only applies to Net::FTP | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | user => "", # set user directly, either directly (insecure -> visible) or via sensitive lookup | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | process => { # used to pass information within each process (data, additionalLookupData, filenames, hadErrors, retrievedFiles or commandline parameters starting with interactive) and for additional configurations not suitable for DB, File or FTP (e.g. uploadCMD* and onlyExecFor) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | additionalLookupData => {}, # additional data retrieved from database with EAI::Wrap::getAdditionalDBData | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | archivefilenames => [], # in case a zip archive package is retrieved, the filenames of these packages are kept here, necessary for cleanup at the end of the process | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | countPercent => 0, # percentage for counting File text reading and DB storing, if given (greater 0) then on each reaching of the percentage in countPercent a progress is shown (e.g. every 10% if countPercent = 10). Any value >=100 will count ALL lines... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | data => [], # loaded data: array (rows) of hash refs (columns) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | filenames => [], # names of files that were retrieved and checked to be locally available for that load, can be more than the defined file in File->filename (due to glob spec or zip archive package) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | filesProcessed => {}, # hash for checking the processed files, necessary for cleanup at the end of the whole task | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | hadErrors => 1, # set to 1 if there were any errors in the process | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | interactive_ => "", # interactive options (are not checked), can be used to pass arbitrary data via command line into the script (eg a selected date for the run with interactive_date). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | onlyExecFor => qr//, # define loads to only be executed when $common{task}{execOnly} !~ $load->{process}{onlyExecFor}. Empty onlyExecFor loads are always executed regardless of $common{task}{execOnly} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | retrievedFiles => [], # files retrieved from FTP or redo directory | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | successfullyDone => "", # accumulates API sub names to prevent most API calls that ran successfully from being run again. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | uploadCMD => "", # upload command for use with uploadFileCMD | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | uploadCMDPath => "", # path of upload command | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | uploadCMDLogfile => "", # logfile where command given in uploadCMD writes output (for error handling) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | task => { # contains parameters used on the task script level, only available for %common parameter hash. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | customHistoryTimestamp => "", # optional custom timestamp to be added to filenames moved to History/HistoryUpload/FTP archive, if not given, get_curdatetime is used (YYYYMMDD_hhmmss) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | execOnly => "", # do not execute loads where $common{task}{execOnly} !~ $load->{process}{onlyExecFor}. Empty onlyExecFor loads are always executed regardless of $common{task}{execOnly} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | ignoreNoTest => 0, # ignore the notest file in the process-script folder, usually preventing all runs that are not in production | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | plannedUntil => 2359, # latest time that planned repetition should start, this can be given either as HHMM (HourMinute) or HHMMSS (HourMinuteSecond), in case of HHMM the "Second" part is attached as 59 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | redoFile => 1, # flag for specifying a redo | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | redoTimestampPatternPart => "", # part of the regex for checking against filename in redo with additional timestamp/redoDir pattern (e.g. "redo", numbers and _), anything after files barename (and before ".$ext" if extension is defined) is regarded as a timestamp. Example: '[\d_]', the regex is built like ($ext ? qr/$barename($redoTimestampPatternPart|$redoDir)*\.$ext/ : qr/$barename($redoTimestampPatternPart|$redoDir)*.*/) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | retryEndsAfterMidnight => 1, # if set, all retries should end after midnight | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | retrySecondsErr => 60, # retry period in case of error | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | retrySecondsErrAfterXfails => 600, # after fail count is reached this alternate retry period in case of error is applied. If 0/undefined then job finishes after fail count | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | retrySecondsXfails => 3, # fail count after which the retrySecondsErr are changed to retrySecondsErrAfterXfails | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | retrySecondsPlanned => 300, # retry period in case of planned retry | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | skipHolidays => "", # skip script execution on holidays | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | skipHolidaysDefault => "", # holiday calendar to take into account for skipHolidays | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | skipWeekends => 0, # skip script execution on weekends | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | skipForFirstBusinessDate => "", # used for "wait with execution for first business date", either this is a calendar or 1 (then calendar is skipHolidaysDefault), this cannot be used together with skipHolidays | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | # alternate type checking for these as they might have different types | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | my %alternateType = ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | 0 | ▶ | configexecuteOnInit => sub {}, # can be eval string or anonymous sub | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | 0 | ▶ | DBpostDumpProcessing => sub {}, # can be eval string or anonymous sub | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | 0 | ▶ | DBpostReadProcessing => sub {}, # can be eval string or anonymous sub | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | Filecolumns => [], # can be ref to hash or ref to array | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | Fileformat_skip => 1, # can be "skip until pattern" string or line number (int) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | Fileformat_sep => qr//, # can be separator string or regex split | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | 0 | ▶ | FilelineCode => sub {}, # can be eval string or anonymous sub | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | 3 | FTPremoteHost => "", # can also be string | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | taskskipHolidays => 1, # can be calendar string or true (1) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | taskskipForFirstBusinessDate => 1, # can be calendar string or true (1) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | # passed options containing numerical strings are converted to numbers if their hash check (definition) looks like a number and their leading zero shouldn't be preserved | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | # currently below two parameters are to be treated as strings. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | 3 | my %allow_leading_zeros = ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | task => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | plannedUntil => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | DB => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | cutoffYr2000 => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | 3 | our %common;our %config;our @loads;our %execute;our @optload;our %opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | 3 | our $EAI_WRAP_CONFIG_PATH; our $EAI_WRAP_SENS_CONFIG_PATH; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | 3 | my @coreConfig = ("DB","File","FTP","process"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | 3 | my @commonCoreConfig = (@coreConfig,"task"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | 3 | my @allConfig = (@commonCoreConfig,"config"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | 3 | our $logConfig; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | # read given config file (eval perl code) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | 0 | ▶ | sub readConfigFile ($) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
readConfigFile: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | 0 | my ($configfilename) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | 0 | my $siteCONFIGFILE; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | 0 | ▶ | open (CONFIGFILE, "<$configfilename") or confess("couldn't open $configfilename: $@ $!, caller ".(caller(1))[3].", line ".(caller(1))[2]." in ".(caller(1))[1]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | 0 | local $/=undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | 0 | $siteCONFIGFILE = <CONFIGFILE>; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | 0 | close CONFIGFILE; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | 0 | ▶ | unless (my $return = eval $siteCONFIGFILE) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | 0 | ▶ | confess("Error parsing config file $configfilename for script $execute{homedir}/$execute{scriptname}: $@") if $@; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | 0 | ▶ | confess("Error executing config file $configfilename for script $execute{homedir}/$execute{scriptname}: $!") unless defined $return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | 0 | print STDOUT "included $configfilename\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | # get key info from $config{sensitive}{$prefix}{$key}. Also checks if $config{sensitive}{$prefix}{$key} is a hash, then get info from $config{sensitive}{$prefix}{$key}{$execute{env}} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | 2 | ▶ | sub getSensInfo ($$) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getSensInfo: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | 2 | my ($prefix,$key) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | # depending on queried key being a ref to hash, get the environment lookup hash key value or the value directly | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | 2 | ▶ | return (ref($config{sensitive}{$prefix}{$key}) eq "HASH" ? $config{sensitive}{$prefix}{$key}{$execute{env}} : $config{sensitive}{$prefix}{$key}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | # setupConfigMerge creates cascading inheritance of config/DB/File/FTP/process/task settings | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | 2 | ▶ | sub setupConfigMerge { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
setupConfigMerge: called CC=32 SCAR=38.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | 2 | my $logger = get_logger(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | 2 | for (@commonCoreConfig) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | # fill missing keys in order to avoid Can't use an undefined value as a HASH reference errors in hash config merging later | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | 10 | ▶ | $common{$_} = {} if !defined($common{$_}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | 10 | ▶ | $config{$_} = {} if !defined($config{$_}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | 10 | ▶ | $opt{$_} = {} if !defined($opt{$_}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | # check for unintended merging/inheritance into sections of loads defined with underscore (inheritance prevention) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | 2 | for my $check (0..$#loads) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | 4 | for my $hashName (@allConfig) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | 24 | ▶ | if (defined($loads[$check]{$hashName."_"})) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | # first write the $hashName."_" values into the normal config hash... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | 1 | for my $defkey (keys %{$loads[$check]{$hashName."_"}}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | 0 | $loads[$check]{$hashName}{$defkey} = $loads[$check]{$hashName."_"}{$defkey}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | 1 | for my $defkey (keys %{$common{$hashName}}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | 1 | ▶ | if (!defined($loads[$check]{$hashName."_"}{$defkey})) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | 1 | $loads[$check]{$hashName}{$defkey} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | 1 | $logger->debug("creating empty $hashName\{$defkey\} in load $check instead of inheriting, because ${hashName}_ is given here"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | 1 | delete $loads[$check]{$hashName."_"}; # need to remove, otherwise checkHash further below throws an error for these... | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | # fall back to config level defined settings for prefix (in config subhash "lookups") if given/defined | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | 2 | for my $hashName (@commonCoreConfig) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | 10 | for my $defkey (keys %{$hashCheck{$hashName}}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | 280 | ▶ | if (defined($config{$hashName}{lookups})) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | # do this for common config | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | 0 | ▶ | if (defined($config{$hashName}{lookups}{$common{$hashName}{prefix}}) and defined($config{$hashName}{lookups}{$common{$hashName}{prefix}}{$defkey})) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $EAI::Common::config{$hashName}{"lookups"}{$EAI::Common::common{$hashName}{"prefix"}} and defined $EAI::Common::config{$hashName}{"lookups"}{$EAI::Common::common{$hashName}{"prefix"}}{$defkey}
MC/DC0%0/2
defined $EAI::Common::config{$hashName}{"lookups"}{$EAI::Common::common{$hashName}{"prefix"}} and defined $EAI::Common::config{$hashName}{"lookups"}{$EAI::Common::common{$hashName}{"prefix"}}{$defkey}
defined $EAI::Common::config{$hashName}{"lookups"}{$EAI::Common::common{$hashName}{"prefix"}}
defined $EAI::Common::config{$hashName}{"lookups"}{$EAI::Common::common{$hashName}{"prefix"}}{$defkey}
Truth table0%0/3
A and B
A= defined $EAI::Common::config{$hashName}{"lookups"}{$EAI::Common::common{$hashName}{"prefix"}}B= defined $EAI::Common::config{$hashName}{"lookups"}{$EAI::Common::common{$hashName}{"prefix"}}{$defkey}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | 0 | $common{$hashName}{$defkey} = $config{$hashName}{lookups}{$common{$hashName}{prefix}}{$defkey}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | # and also for loads | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | 0 | for my $i (0..$#loads) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | 0 | ▶ | if (defined($config{$hashName}{lookups}{$loads[$i]{$hashName}{prefix}}) and defined($config{$hashName}{lookups}{$loads[$i]{$hashName}{prefix}}{$defkey})) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $EAI::Common::config{$hashName}{"lookups"}{$EAI::Common::loads[$i]{$hashName}{"prefix"}} and defined $EAI::Common::config{$hashName}{"lookups"}{$EAI::Common::loads[$i]{$hashName}{"prefix"}}{$defkey}
MC/DC0%0/2
defined $EAI::Common::config{$hashName}{"lookups"}{$EAI::Common::loads[$i]{$hashName}{"prefix"}} and defined $EAI::Common::config{$hashName}{"lookups"}{$EAI::Common::loads[$i]{$hashName}{"prefix"}}{$defkey}
defined $EAI::Common::config{$hashName}{"lookups"}{$EAI::Common::loads[$i]{$hashName}{"prefix"}}
defined $EAI::Common::config{$hashName}{"lookups"}{$EAI::Common::loads[$i]{$hashName}{"prefix"}}{$defkey}
Truth table0%0/3
A and B
A= defined $EAI::Common::config{$hashName}{"lookups"}{$EAI::Common::loads[$i]{$hashName}{"prefix"}}B= defined $EAI::Common::config{$hashName}{"lookups"}{$EAI::Common::loads[$i]{$hashName}{"prefix"}}{$defkey}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | 0 | $loads[$i]{$hashName}{$defkey} = $config{$hashName}{lookups}{$loads[$i]{$hashName}{prefix}}{$defkey}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | # do check before the merging below removes all nonconforming entries. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | 2 | ▶ | checkHash(\%config,"config") or $logger->error($@.longmess()); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | 2 | ▶ | checkHash(\%common,"common") or $logger->error($@.longmess()); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | 2 | ▶ | for my $i (0..$#loads) {checkHash($loads[$i],"load") or $logger->error($@.longmess());} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | # merge cmdline option overrides into toplevel global config (DB, FTP, File and process overrides are merged directly into common below)... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | 2 | ▶ | %config=(%config,%{$opt{config}}) if $opt{config}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | # merge DB/FTP/File/process/task sections from global config and cmdline options into common... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | 2 | %common=(DB=>{%{$config{DB}},%{$common{DB}},%{$opt{DB}}},FTP=>{%{$config{FTP}},%{$common{FTP}},%{$opt{FTP}}},File=>{%{$config{File}},%{$common{File}},%{$opt{File}}},process=>{%{$config{process}},%{$common{process}},%{$opt{process}}},task=>{%{$config{task}},%{$common{task}},%{$opt{task}}},); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | # now merge above into the the loads including cmdline options, except the task section... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | 2 | for my $i (0..$#loads) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | # fill missing keys in order to avoid Can't use an undefined value as a HASH reference errors in hash config merging later | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | 4 | for (@coreConfig) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | 16 | ▶ | $loads[$i]{$_} = {} if !defined($loads[$i]{$_}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | 16 | ▶ | $optload[$i]{$_} = {} if !defined($optload[$i]{$_}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | # merge common and cmdline option overrides into loads | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | 4 | $loads[$i]={DB=>{%{$common{DB}},%{$loads[$i]{DB}},%{$optload[$i]{DB}}},FTP=>{%{$common{FTP}},%{$loads[$i]{FTP}},%{$optload[$i]{FTP}}},File=>{%{$common{File}},%{$loads[$i]{File}},%{$optload[$i]{File}}},process=>{%{$common{process}},%{$loads[$i]{process}},%{$optload[$i]{process}}}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | # remove load elements where $common{task}{execOnly} !~ $load->{process}{onlyExecFor} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | 2 | my $i=0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | 2 | ▶ | while ($i <= $#loads) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | 4 | ▶ | if ($common{task}{execOnly} and $loads[$i]{process}{onlyExecFor} and $common{task}{execOnly} !~ $loads[$i]{process}{onlyExecFor}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
$EAI::Common::common{"task"}{"execOnly"} and $EAI::Common::loads[$i]{"process"}{"onlyExecFor"} and not $EAI::Common::common{"task"}{"execOnly"} =~ /$EAI::Common::loads[$i]{"process"}{"onlyExecFor"}/u
$EAI::Common::common{"task"}{"execOnly"} and $EAI::Common::loads[$i]{"process"}{"onlyExecFor"}
MC/DC0%0/3
$EAI::Common::common{"task"}{"execOnly"} and $EAI::Common::loads[$i]{"process"}{"onlyExecFor"} and not $EAI::Common::common{"task"}{"execOnly"} =~ /$EAI::Common::loads[$i]{"process"}{"onlyExecFor"}/u
$EAI::Common::common{"task"}{"execOnly"}
$EAI::Common::loads[$i]{"process"}{"onlyExecFor"}
not $EAI::Common::common{"task"}{"execOnly"} =~ /$EAI::Common::loads[$i]{"process"}{"onlyExecFor"}/u
Truth table25%1/4
A and B and not(C)
A= $EAI::Common::common{"task"}{"execOnly"}B= $EAI::Common::loads[$i]{"process"}{"onlyExecFor"}C= not $EAI::Common::common{"task"}{"execOnly"} =~ /$EAI::Common::loads[$i]{"process"}{"onlyExecFor"}/u
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | 0 | $logger->debug("removing load $i because \$common{task}{execOnly} given and $common{task}{execOnly} !~ $loads[$i]{process}{onlyExecFor} (\$load{process}{onlyExecFor}), \$#loads: $#loads"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | 0 | splice @loads, $i, 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | 4 | $i++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | # get options for overriding configured settings | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | 1 | ▶ | sub getOptions { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getOptions: called CC=23 SCAR=44.6
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | # construct option definitions for Getopt::Long::GetOptions, everything parsed as a string first | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | 1 | my %optiondefs = ("DB=s%" => \$opt{DB}, "FTP=s%" => \$opt{FTP}, "File=s%" => \$opt{File},"process=s%" => \$opt{process}, "task=s%" => \$opt{task}, "config=s%" => \$opt{config}); # first option overrides for common | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | 1 | for my $i (0..$#loads) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | # then option overrides for each load | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | 2 | %optiondefs = (%optiondefs, "load${i}DB=s%" => \$optload[$i]{DB}, "load${i}FTP=s%" => \$optload[$i]{FTP}, "load${i}File=s%" => \$optload[$i]{File},"load${i}process=s%" => \$optload[$i]{process}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | 1 | my @orig_ARGV = @ARGV; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | 1 | Getopt::Long::GetOptions(%optiondefs); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | 1 | @ARGV = @orig_ARGV; # restore @ARGV in case the calling script does its own option processing | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | # now correct strings to numeric where needed, also checking validity | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | 1 | my $errStr; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | 1 | for my $hashName (@allConfig) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | 6 | for my $defkey (keys %{$opt{$hashName}}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | # allow only options predefined in $hashCheck or generic option --process interactive.*=..., here everything can be passed into the process script | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | 1 | ▶ | unless (exists($hashCheck{$hashName}{$defkey}) or ($hashName eq "process" and $defkey =~ /interactive.*/)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition16%1/6
exists $hashCheck{$hashName}{$defkey} or $hashName eq "process" and $defkey =~ /interactive.*/u
$hashName eq "process" and $defkey =~ /interactive.*/u
MC/DC0%0/3
exists $hashCheck{$hashName}{$defkey} or $hashName eq "process" and $defkey =~ /interactive.*/u
exists $hashCheck{$hashName}{$defkey}
$hashName eq "process"
$defkey =~ /interactive.*/u
Truth table25%1/4
A or B and C
A= exists $hashCheck{$hashName}{$defkey}B= $hashName eq "process"C= $defkey =~ /interactive.*/u
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | 0 | $errStr.="option not allowed: --$hashName $defkey=<value>\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | # convert passed numerical strings to numbers if their hash check (definition) looks like a number and their leading zero shouldn't be preserved (currently for two parameters) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | 1 | ▶ | $opt{$hashName}{$defkey} = 0+$opt{$hashName}{$defkey} if looks_like_number($hashCheck{$hashName}{$defkey}) and !$allow_leading_zeros{$hashName}{$defkey}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
&looks_like_number($hashCheck{$hashName}{$defkey}) and not $allow_leading_zeros{$hashName}{$defkey}
MC/DC0%0/2
&looks_like_number($hashCheck{$hashName}{$defkey}) and not $allow_leading_zeros{$hashName}{$defkey}
&looks_like_number($hashCheck{$hashName}{$defkey})
not $allow_leading_zeros{$hashName}{$defkey}
Truth table33%1/3
A and not(B)
A= &looks_like_number($hashCheck{$hashName}{$defkey})B= not $allow_leading_zeros{$hashName}{$defkey}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | 6 | for my $i (0..$#loads) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | 12 | ▶ | next if $hashName eq "config" or $hashName eq "task" ; # no config or task section in loads... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$hashName eq "config" or $hashName eq "task"
MC/DC100%2/2
$hashName eq "config" or $hashName eq "task"
$hashName eq "config"
$hashName eq "task"
Truth table100%3/3
A or B
A= $hashName eq "config"B= $hashName eq "task"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | 8 | for my $defkey (keys %{$optload[$i]{$hashName}}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | # allow only options predefined in $hashCheck or generic option --process interactive.*=..., here everything can be passed into the process script | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | 1 | ▶ | unless (exists($hashCheck{$hashName}{$defkey}) or ($hashName eq "process" and $defkey =~ /interactive.*/)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition16%1/6
exists $hashCheck{$hashName}{$defkey} or $hashName eq "process" and $defkey =~ /interactive.*/u
$hashName eq "process" and $defkey =~ /interactive.*/u
MC/DC0%0/3
exists $hashCheck{$hashName}{$defkey} or $hashName eq "process" and $defkey =~ /interactive.*/u
exists $hashCheck{$hashName}{$defkey}
$hashName eq "process"
$defkey =~ /interactive.*/u
Truth table25%1/4
A or B and C
A= exists $hashCheck{$hashName}{$defkey}B= $hashName eq "process"C= $defkey =~ /interactive.*/u
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | 0 | $errStr.="option not allowed: --load$i$hashName $defkey=<value>\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | 1 | ▶ | $optload[$i]{$hashName}{$defkey} = 0+$optload[$i]{$hashName}{$defkey} if looks_like_number($hashCheck{$hashName}{$defkey}) and !$allow_leading_zeros{$hashName}{$defkey}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
&looks_like_number($hashCheck{$hashName}{$defkey}) and not $allow_leading_zeros{$hashName}{$defkey}
MC/DC0%0/2
&looks_like_number($hashCheck{$hashName}{$defkey}) and not $allow_leading_zeros{$hashName}{$defkey}
&looks_like_number($hashCheck{$hashName}{$defkey})
not $allow_leading_zeros{$hashName}{$defkey}
Truth table33%1/3
A and not(B)
A= &looks_like_number($hashCheck{$hashName}{$defkey})B= not $allow_leading_zeros{$hashName}{$defkey}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | 1 | ▶ | if ($errStr) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | 0 | my $availabeOpts; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | 0 | for my $hashName (sort @allConfig) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | 0 | for my $defkey (sort keys %{$hashCheck{$hashName}}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | 0 | ▶ | $availabeOpts.="--$hashName $defkey=<value>\n" if ref($hashCheck{$hashName}{$defkey}) ne "HASH" and ref($hashCheck{$hashName}{$defkey}) ne "ARRAY"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
ref $hashCheck{$hashName}{$defkey} ne "HASH" and ref $hashCheck{$hashName}{$defkey} ne "ARRAY"
MC/DC0%0/2
ref $hashCheck{$hashName}{$defkey} ne "HASH" and ref $hashCheck{$hashName}{$defkey} ne "ARRAY"
ref $hashCheck{$hashName}{$defkey} ne "HASH"
ref $hashCheck{$hashName}{$defkey} ne "ARRAY"
Truth table0%0/3
A and B
A= ref $hashCheck{$hashName}{$defkey} ne "HASH"B= ref $hashCheck{$hashName}{$defkey} ne "ARRAY"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | 0 | confess $errStr."===> available options (use --load<N><group> instead of --<group> for load specific settings):\n".$availabeOpts; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | # extract config hashes (DB,FTP,File,process; task is always part of common, which is always there) from $arg hash and return as list of hashes. The config hashes to be extracted are given in string list @required and returned in @ret | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | # side effect: sets error subject to first argument $contextSub if ne "" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | 3 | ▶ | sub extractConfigs ($$$;@) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
extractConfigs: called CC=7 SCAR=19.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | 3 | my ($contextSub,$arg,@required) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | 3 | my $logger = get_logger(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | 3 | ▶ | $logger->debug(($contextSub ? "setting err subject <$contextSub> for " : "").(caller(1))[3]) if caller(1); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | 3 | ▶ | setErrSubject($contextSub) if $contextSub; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | 3 | my @ret; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | 3 | ▶ | if (ref($arg) eq "HASH") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | 3 | for my $req (@required) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | 3 | push(@ret, \%{$arg->{$req}}); # return the required subhash into the list of hashes | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | 3 | ▶ | checkHash($ret[$#ret],$req) or $logger->error($@.longmess()); # check last added hash after adding it... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | 0 | $logger->error("no ref to hash passed".longmess()); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | 3 | return @ret; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | # check config hash passed in $hash for validity against hashCheck (valid key entries are there + their valid value types (examples)). returns 0 on error and exception $@ contains details | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | 15 | ▶ | sub checkHash ($$) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
checkHash: called CC=21 SCAR=33.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | 15 | my ($hash, $hashName) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | 15 | eval { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | 15 | for my $defkey (keys %{$hash}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | 52 | ▶ | unless ($hashName eq "process" and $defkey =~ /interactive.*/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$hashName eq "process" and $defkey =~ /interactive.*/u
MC/DC0%0/2
$hashName eq "process" and $defkey =~ /interactive.*/u
$hashName eq "process"
$defkey =~ /interactive.*/u
Truth table66%2/3
A and B
A= $hashName eq "process"B= $defkey =~ /interactive.*/u
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | 52 | ▶ | if (!exists($hashCheck{$hashName}{$defkey})) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | 1 | confess "key name not allowed: \$".$hashName."{".$defkey."}, following is possible:\n".Dumper($hashCheck{$hashName}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | # check type for existing keys, if explicitly not defined then ignore... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | 51 | ▶ | if (defined($hash->{$defkey})) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | 51 | ▶ | if (ref($hashCheck{$hashName}{$defkey}) ne ref($hash->{$defkey})) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | 1 | ▶ | if (!defined($alternateType{$hashName.$defkey}) or (ref($alternateType{$hashName.$defkey}) ne ref($hash->{$defkey}))) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not defined $alternateType{$hashName . $defkey} or ref $alternateType{$hashName . $defkey} ne ref $hash->{$defkey}
MC/DC0%0/2
not defined $alternateType{$hashName . $defkey} or ref $alternateType{$hashName . $defkey} ne ref $hash->{$defkey}
not defined $alternateType{$hashName . $defkey}
ref $alternateType{$hashName . $defkey} ne ref $hash->{$defkey}
Truth table33%1/3
not(A) or B
A= not defined $alternateType{$hashName . $defkey}B= ref $alternateType{$hashName . $defkey} ne ref $hash->{$defkey}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | 1 | confess "wrong reference type for value: \$".$hashName."{".$defkey."}:".ref($hash->{$defkey}).", it should be either:".ref($hashCheck{$hashName}{$defkey})." or:".ref($alternateType{$hashName.$defkey}).","; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | # numeric check: either hashcheck is same looks_like_number as given key or alternateType is same looks_like_number | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | 50 | ▶ | if (looks_like_number($hash->{$defkey}) and !looks_like_number($hashCheck{$hashName}{$defkey})) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
&looks_like_number($hash->{$defkey}) and not &looks_like_number($hashCheck{$hashName}{$defkey})
MC/DC100%2/2
&looks_like_number($hash->{$defkey}) and not &looks_like_number($hashCheck{$hashName}{$defkey})
&looks_like_number($hash->{$defkey})
not &looks_like_number($hashCheck{$hashName}{$defkey})
Truth table100%3/3
A and not(B)
A= &looks_like_number($hash->{$defkey})B= not &looks_like_number($hashCheck{$hashName}{$defkey})
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | 1 | ▶ | if (!defined($alternateType{$hashName.$defkey}) or (looks_like_number($hash->{$defkey}) and !looks_like_number($alternateType{$hashName.$defkey}))) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
not defined $alternateType{$hashName . $defkey} or &looks_like_number($hash->{$defkey}) and not &looks_like_number($alternateType{$hashName . $defkey})
&looks_like_number($hash->{$defkey}) and not &looks_like_number($alternateType{$hashName . $defkey})
MC/DC0%0/3
not defined $alternateType{$hashName . $defkey} or &looks_like_number($hash->{$defkey}) and not &looks_like_number($alternateType{$hashName . $defkey})
not defined $alternateType{$hashName . $defkey}
&looks_like_number($hash->{$defkey})
not &looks_like_number($alternateType{$hashName . $defkey})
Truth table25%1/4
not(A) or B and not(C)
A= not defined $alternateType{$hashName . $defkey}B= &looks_like_number($hash->{$defkey})C= not &looks_like_number($alternateType{$hashName . $defkey})
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | 1 | confess "wrong numeric type for value: \$".$hashName."{".$defkey."},"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | # non-numeric check: if non-numeric type given, then check if either hashcheck looks like a number or hashcheck was a ref type and alternateType looks like a number | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | 49 | ▶ | if (!looks_like_number($hash->{$defkey}) and !ref($hash->{$defkey}) and looks_like_number($hashCheck{$hashName}{$defkey})) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%6/6
not &looks_like_number($hash->{$defkey}) || ref $hash->{$defkey} and &looks_like_number($hashCheck{$hashName}{$defkey})
&looks_like_number($hash->{$defkey}) || ref $hash->{$defkey}
MC/DC100%3/3
not &looks_like_number($hash->{$defkey}) || ref $hash->{$defkey} and &looks_like_number($hashCheck{$hashName}{$defkey})
&looks_like_number($hash->{$defkey})
ref $hash->{$defkey}
&looks_like_number($hashCheck{$hashName}{$defkey})
Truth table100%4/4
not(A || B) and C
A= &looks_like_number($hash->{$defkey})B= ref $hash->{$defkey}C= &looks_like_number($hashCheck{$hashName}{$defkey})
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | 1 | ▶ | if (!defined($alternateType{$hashName.$defkey}) or (!looks_like_number($hash->{$defkey}) and looks_like_number($alternateType{$hashName.$defkey}))) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition16%1/6
not defined $alternateType{$hashName . $defkey} or not &looks_like_number($hash->{$defkey}) and &looks_like_number($alternateType{$hashName . $defkey})
not &looks_like_number($hash->{$defkey}) and &looks_like_number($alternateType{$hashName . $defkey})
MC/DC0%0/3
not defined $alternateType{$hashName . $defkey} or not &looks_like_number($hash->{$defkey}) and &looks_like_number($alternateType{$hashName . $defkey})
not defined $alternateType{$hashName . $defkey}
not &looks_like_number($hash->{$defkey})
&looks_like_number($alternateType{$hashName . $defkey})
Truth table25%1/4
not(A) or not(B) and C
A= not defined $alternateType{$hashName . $defkey}B= not &looks_like_number($hash->{$defkey})C= &looks_like_number($alternateType{$hashName . $defkey})
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | 1 | confess "wrong non-numeric type for value: \$".$hashName."{".$defkey."},"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | 15 | ▶ | return 0 if $@; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | 11 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | # check parameter passed in $subhash | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | 3 | ▶ | sub checkParam ($$) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
checkParam: called CC=5 SCAR=18.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 464 | 3 | my ($subhash,$keytoCheck) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | 3 | my $logger = get_logger(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 466 | 3 | ▶ | if (ref($subhash) ne "HASH") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 467 | 0 | $logger->error("passed argument subhash to checkParam is not a hash".longmess()); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 468 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 469 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 470 | 3 | my ($subhashname) = split /=/, Dumper($subhash); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 471 | 3 | $subhashname =~ s/\$//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 472 | 3 | ▶ | if (!defined($subhash->{$keytoCheck})) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 473 | 2 | $logger->error("key $keytoCheck not defined in subhash ".dumpFlat($subhash,1).longmess()); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 474 | 2 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 475 | ▶ | } elsif (!$subhash->{$keytoCheck} and !looks_like_number($hashCheck{$subhashname}{$keytoCheck})) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$subhash->{$keytoCheck} || &looks_like_number($hashCheck{$subhashname}{$keytoCheck})
MC/DC0%0/2
$subhash->{$keytoCheck} || &looks_like_number($hashCheck{$subhashname}{$keytoCheck})
$subhash->{$keytoCheck}
&looks_like_number($hashCheck{$subhashname}{$keytoCheck})
Truth table33%1/3
A || B
A= $subhash->{$keytoCheck}B= &looks_like_number($hashCheck{$subhashname}{$keytoCheck})
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 476 | 0 | $logger->error("value of key $keytoCheck empty in subhash ".dumpFlat($subhash,1).longmess()); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 477 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 478 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 479 | 1 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 480 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 481 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 482 | # path of logfile and path of yesterdays logfile (after rolling) - getLogFPathForMail and getLogFPath can be used in site-wide log.config | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 483 | 3 | our ($LogFPath, $LogFPathDayBefore); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 484 | 0 | ▶ | sub getLogFPathForMail { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getLogFPathForMail: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 485 | 0 | ▶ | return 'file://'.$LogFPath.($LogFPathDayBefore ? ', or '.'file://'.$LogFPathDayBefore : ''); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 486 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 487 | # called by log4perl.appender.FILE.filename = ... so always provide the logfile path here | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 488 | 0 | ▶ | sub getLogFPath { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getLogFPath: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 489 | 0 | return $LogFPath; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 490 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 491 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 492 | # MailFilter is used for filtering error logs (called in log.config) if a log error was already sent by mail (otherwise floods)...this is reset on retry because of error | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 493 | 3 | our $alreadySent = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 494 | 0 | ▶ | sub MailFilter { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
MailFilter: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 495 | 0 | my %p = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 496 | 0 | ▶ | return (!$alreadySent && ($p{log4p_level} eq "ERROR" || $p{log4p_level} eq "FATAL") ? $alreadySent = 1 : 0); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
not $EAI::Common::alreadySent and $p{"log4p_level"} eq "ERROR" || $p{"log4p_level"} eq "FATAL"
$p{"log4p_level"} eq "ERROR" or $p{"log4p_level"} eq "FATAL"
MC/DC0%0/3
not $EAI::Common::alreadySent and $p{"log4p_level"} eq "ERROR" || $p{"log4p_level"} eq "FATAL"
not $EAI::Common::alreadySent
$p{"log4p_level"} eq "ERROR"
$p{"log4p_level"} eq "FATAL"
Truth table0%0/4
not(A) and B or C
A= not $EAI::Common::alreadySentB= $p{"log4p_level"} eq "ERROR"C= $p{"log4p_level"} eq "FATAL"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 497 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 498 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 499 | # sets the error subject for the subsequent error mails from logger->error() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 500 | 2 | ▶ | sub setErrSubject ($) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
setErrSubject: called CC=2 SCAR=7.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 501 | 2 | my ($context) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 502 | 2 | ▶ | Log::Log4perl->appenders()->{"MAIL"}->{"appender"}->{"subject"} = [($execute{envraw} ? $execute{envraw}.": " : "").$execute{errmailsubject}.": $context"]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 503 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 504 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 505 | # setup logging for Log4perl | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 506 | 0 | ▶ | sub setupLogging { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
setupLogging: not called CC=35 SCAR=71.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 507 | 0 | my $extendedScriptname = $execute{scriptname}.$execute{addToScriptName}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 508 | 0 | ▶ | my $prodEnvironmentInSeparatePath = ($config{checkLookup}{$extendedScriptname}{prodEnvironmentInSeparatePath} ne "" ? $config{checkLookup}{$extendedScriptname}{prodEnvironmentInSeparatePath} : $config{prodEnvironmentInSeparatePath}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 509 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 510 | # get logRootPath, historyFolder, historyFolderUpload and redoDir from lookups in config. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 511 | # if they are not in the script home directory (having an absolute path) then build environment-path separately for end folder (script home directory is already in its environment) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 512 | 0 | for my $foldKey ("redoDir","logRootPath","historyFolder","historyFolderUpload") { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 513 | 0 | ▶ | warn ("\$config{$foldKey} is not a hash, cannot get $foldKey from it !") if (ref($config{$foldKey}) ne "HASH"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 514 | 0 | ▶ | my $folder = $config{$foldKey}{$extendedScriptname} if (ref($config{$foldKey}) eq "HASH"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 515 | 0 | my $defaultFolder; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 516 | 0 | ▶ | if (!$folder) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 517 | 0 | $folder = $config{$foldKey}{""}; # take default, if no lookup defined for script | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 518 | 0 | $defaultFolder = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 519 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 520 | 0 | ▶ | $folder = $opt{config}{$foldKey} if $opt{config}{$foldKey}; # also possible to override these settings via options | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 521 | # convert backslash to slash to avoid problems in string handling (unicode ...) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 522 | 0 | $folder =~ s/\\/\//g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 523 | 0 | ▶ | if ($folder =~ /^(\S:)*\/(.*?)$/ and !$opt{config}{$foldKey}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$folder =~ m[^(\S:)*/(.*?)$]u and not $EAI::Common::opt{"config"}{$foldKey}
MC/DC0%0/2
$folder =~ m[^(\S:)*/(.*?)$]u and not $EAI::Common::opt{"config"}{$foldKey}
$folder =~ m[^(\S:)*/(.*?)$]u
not $EAI::Common::opt{"config"}{$foldKey}
Truth table0%0/3
A and not(B)
A= $folder =~ m[^(\S:)*/(.*?)$]uB= not $EAI::Common::opt{"config"}{$foldKey}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 524 | 0 | my ($folderPath,$endFolder) = ($folder =~ /(.*)\/(.*?)$/); # slash acts as path separator for last part | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 525 | # default Folder is built with environment: folderPath/endFolder/environ instead of folderPath/environ/endFolder | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 526 | # environments are built depending on prodEnvironmentInSeparatePath: either folderPath/endFolder/$execute{env} (Prod has own subfolder) or folderPath/endFolder/$execute{envraw} (Prod is in common folder, other environments have their own folder) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 527 | $execute{$foldKey} = ($defaultFolder | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 528 | ? $folderPath."/".$endFolder.($prodEnvironmentInSeparatePath | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 529 | ? '/'.$execute{env} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 530 | : ($execute{envraw} ? '/'.$execute{envraw} : "")) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 531 | : $folderPath."/".($prodEnvironmentInSeparatePath | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 532 | ? '/'.$execute{env} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 533 | 0 | ▶ | : ($execute{envraw} ? '/'.$execute{envraw} : "")).$endFolder); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 5 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 534 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 535 | # folders without slashes are assumed to be relative to home, so now amendment with environment needed. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 536 | 0 | $execute{$foldKey} = $folder; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 537 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 538 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 539 | 0 | my $logFolder = $execute{logRootPath}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 540 | # if logFolder doesn't exist, warn and log to $execute{homedir}. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 541 | 0 | ▶ | if (! -e $logFolder) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 542 | 0 | print "can't log to logfolder '".$logFolder."' (set specially for script with \$config{logRootPath}{$extendedScriptname} or default with \$config{logRootPath}{\"\"}), folder doesn't exist. Setting to $execute{homedir}\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 543 | 0 | $logFolder = $execute{homedir}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 544 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 545 | 0 | $LogFPath = $logFolder."/".$extendedScriptname.".log"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 546 | 0 | $logConfig = $EAI_WRAP_CONFIG_PATH."/".$execute{env}."/log.config"; # environment dependent log config, Prod is either in EAI_WRAP_CONFIG_PATH/.$execute{env} or EAI_WRAP_CONFIG_PATH | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 547 | 0 | ▶ | $logConfig = $EAI_WRAP_CONFIG_PATH."/log.config" if (! -e $logConfig); # fall back to main config log.config | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 548 | 0 | ▶ | confess "log.config neither in $logConfig nor in ".$EAI_WRAP_CONFIG_PATH."/log.config" if (! -e $logConfig); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 549 | 0 | Log::Log4perl::init($logConfig); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 550 | # workaround for utf8 problems with Win32::Console::ANSI | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 551 | 0 | ▶ | if ($^O =~ /MSWin/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 552 | 0 | my $test = \*STDOUT; bless $test, 'IO::Handle'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 553 | 0 | my $testcopy = IO::Handle->new_from_fd($test, ">"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 554 | 0 | $test->fdopen($testcopy, ">"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 555 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 556 | 0 | my $logger = get_logger(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 557 | 0 | ▶ | my $logAppender = Log::Log4perl->appenders()->{"FILE"}->{"appender"} if Log::Log4perl->appenders() and Log::Log4perl->appenders()->{"FILE"}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
"Log::Log4perl"->appenders and "Log::Log4perl"->appenders->{"FILE"}
MC/DC0%0/2
"Log::Log4perl"->appenders and "Log::Log4perl"->appenders->{"FILE"}
"Log::Log4perl"->appenders
"Log::Log4perl"->appenders->{"FILE"}
Truth table0%0/3
A and B
A= "Log::Log4perl"->appendersB= "Log::Log4perl"->appenders->{"FILE"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 558 | 0 | ▶ | if ($logAppender) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 559 | 0 | my $logprefix = get_curdate(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 560 | 0 | ▶ | unless ($logAppender->isa("Log::Dispatch::FileRotate")) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 561 | 0 | $@ = ""; # reset bogus error messages from Log::Log4perl::init | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 562 | 0 | ▶ | eval {$logprefix = $config{logprefixForLastLogfile}->()} if $config{logprefixForLastLogfile}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 563 | 0 | ▶ | $logger->warn("error getting logprefix from \$config{logprefixForLastLogfile}: $@") if $@; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 564 | # if mail is watched next day, the rolled file is in $LogFPathDayBefore. Depending on appender, either append ".1" to filename or prepend $logprefix to it (default assume a date rotator, with current date in format yyyymmdd) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 565 | 0 | $LogFPathDayBefore = "$logFolder/$logprefix.$extendedScriptname.log"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 566 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 567 | 0 | $LogFPathDayBefore = "$logFolder/$extendedScriptname.log.1"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 568 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 569 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 570 | 0 | ▶ | if ($config{smtpServer}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 571 | # remove explicitly enumerated lookups (1:scriptname.pl, 2:scriptname.pl) in case they are used for the current script, the first such entry will be taken here | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 572 | 0 | for my $lookupKey (reverse sort keys(%{$config{checkLookup}})) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 573 | 0 | ▶ | if ($lookupKey =~ /^\d:.*/ and $lookupKey =~ /$execute{scriptname}/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$lookupKey =~ /^\d:.*/u and $lookupKey =~ /$EAI::Common::execute{"scriptname"}/u
MC/DC0%0/2
$lookupKey =~ /^\d:.*/u and $lookupKey =~ /$EAI::Common::execute{"scriptname"}/u
$lookupKey =~ /^\d:.*/u
$lookupKey =~ /$EAI::Common::execute{"scriptname"}/u
Truth table0%0/3
A and B
A= $lookupKey =~ /^\d:.*/uB= $lookupKey =~ /$EAI::Common::execute{"scriptname"}/u
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 574 | 0 | my $lookupKeyAdd = $lookupKey; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 575 | 0 | $lookupKeyAdd =~ s/^\d://; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 576 | 0 | $config{checkLookup}{$lookupKeyAdd} = $config{checkLookup}{$lookupKey}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 577 | 0 | delete($config{checkLookup}{$lookupKey}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 578 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 579 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 580 | # configure err mail sending | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 581 | 0 | MIME::Lite->send('smtp', $config{smtpServer}, AuthUser=>$config{sensitive}{smtpAuth}{user}, AuthPass=>$config{sensitive}{smtpAuth}{pwd}, Timeout=>$config{smtpTimeout}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 582 | # get email from central log error handling $config{checkLookup}{<>}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 583 | 0 | $execute{errmailaddress} = $config{checkLookup}{$extendedScriptname}{errmailaddress}; # errmailaddress for the task script | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 584 | 0 | $execute{errmailsubject} = $config{checkLookup}{$extendedScriptname}{errmailsubject}; # errmailsubject for the task script | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 585 | 0 | ▶ | $execute{errmailaddress} = $config{errmailaddress} if !$execute{errmailaddress}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 586 | 0 | ▶ | $execute{errmailsubject} = $config{errmailsubject} if !$execute{errmailsubject}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 587 | 0 | ▶ | $execute{errmailaddress} = $config{testerrmailaddress} if $execute{envraw}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 588 | 0 | ▶ | if ($execute{errmailaddress}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 589 | 0 | Log::Log4perl->appenders()->{"MAIL"}->{"appender"}->{"to"} = [$execute{errmailaddress}]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 590 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 591 | # Production: no errmailaddress found, error message to Testerrmailaddress (if set) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 592 | 0 | ▶ | Log::Log4perl->appenders()->{"MAIL"}->{"appender"}->{"to"} = [$config{testerrmailaddress}] if $config{testerrmailaddress}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 593 | 0 | ▶ | if ($execute{envraw}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 594 | 0 | $logger->error("no errmailaddress found, no entry found in \$config{testerrmailaddress}".longmess()); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 595 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 596 | 0 | $logger->error("no errmailaddress found for ".$extendedScriptname.", no entry found in \$config{checkLookup}{$extendedScriptname}".longmess()); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 597 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 598 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 599 | 0 | setErrSubject("Setting up EAI::Wrap"); # general context after logging initialization: setup of EAI::Wrap by script | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 600 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 601 | # remove any defined mail appenders | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 602 | 0 | ▶ | undef(Log::Log4perl->appenders()->{"MAIL"}) if Log::Log4perl->appenders()->{"MAIL"}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 603 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 604 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 605 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 606 | # set up EAI configuration | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 607 | 0 | ▶ | sub setupEAIWrap { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
setupEAIWrap: not called CC=7 SCAR=40.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 608 | 0 | my $logger = get_logger(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 609 | 0 | setupConfigMerge(); # %config (from site.config, amended with command line options) and %common (from process script, amended with command line options) are merged into %common and all @loads (amended with command line options) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 610 | # starting log entry: process script name + %common parameters, used for process monitoring (%config is not written due to sensitive information, $execute is stripped down to standard keys to avoid potentially sensitve information there as well) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 611 | 0 | $logger->info("=============================================================================================="); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 612 | 0 | $execute{startingTime} = get_curtime("%02d%02d%02d"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 613 | 0 | my %executeDump; my %configDump; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 614 | 0 | for my $key (keys %{$hashCheck{execute}}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 615 | 0 | $executeDump{$key} = $execute{$key}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 616 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 617 | 0 | for my $key (keys %config) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 618 | 0 | ▶ | $configDump{$key} = $config{$key} if $key ne "sensitive"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 619 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 620 | 0 | $logger->info("started $execute{scriptname} in $execute{homedir} (environment $execute{env}) ... execute parameters: ".dumpFlat(\%executeDump,1,1)." ... common parameters: ".dumpFlat(\%common,1,1)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 621 | 0 | ▶ | if ($logger->is_debug) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 622 | 0 | $logger->debug("config parameters: ".dumpFlat(\%configDump,1,1)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 623 | 0 | $logger->debug("load $_ parameters: ".dumpFlat($loads[$_],1,1)) for (0..$#loads); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 624 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 625 | # check starting conditions and exit if met (returned true) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 626 | 0 | ▶ | checkStartingCond(\%common) and exit 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 627 | 0 | setErrSubject("General EAI::Wrap script execution"); # general context after setup of EAI::Wrap | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 628 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 629 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 630 | # returned Data::Dumpered datastructure given in $arg flattened, sorted (if $sortDump given) and compressed (if $compressDump given) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 631 | 4 | ▶ | sub dumpFlat ($;$$) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
dumpFlat: called CC=3 SCAR=12.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 632 | 4 | my ($arg, $sortDump, $compressDump) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 633 | 4 | $Data::Dumper::Indent = 0; # temporarily flatten dumper output for single line | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 634 | 4 | ▶ | $Data::Dumper::Sortkeys = 1 if $sortDump; # sort keys to get outputs easier to read | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 635 | 4 | $Data::Dumper::Deepcopy = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 636 | 4 | my $dump = Dumper($arg); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 637 | 4 | ▶ | if ($compressDump) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 638 | 0 | $dump =~ s/\s+//g;$dump =~ s/,'/,/g;$dump =~ s/{'/{/g;$dump =~ s/'=>/=>/g; # compress information | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 639 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 640 | 4 | $dump =~ s/\$VAR1//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 641 | 4 | $Data::Dumper::Indent = 2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 642 | 4 | $Data::Dumper::Deepcopy = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 643 | 4 | return $dump; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 644 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 645 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 646 | # check starting conditions and return 1 if met | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 647 | 2 | ▶ | sub checkStartingCond ($) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
checkStartingCond: called CC=19 SCAR=42.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 648 | 2 | my ($arg) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 649 | 2 | my $logger = get_logger(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 650 | 2 | my ($task) = extractConfigs("checking starting conditions",$arg,"task"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 651 | 2 | my $curdate = get_curdate(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 652 | 2 | $logger->debug("checkStartingCond for \$curdate: $curdate, task config:".dumpFlat($task,1)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 653 | # skipHolidays is either a calendar or 1 (then defaults to $task->{skipHolidaysDefault}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 654 | 2 | ▶ | my $holidayCal = $task->{skipHolidays} if $task->{skipHolidays}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 655 | # skipForFirstBusinessDate is for "wait with execution for first business date", either this is a calendar or 1 (then calendar is skipHolidaysDefault), this cannot be used together with skipHolidays | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 656 | 2 | ▶ | $holidayCal = $task->{skipForFirstBusinessDate} if $task->{skipForFirstBusinessDate}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 657 | # default setting (1 becomes $task->{skipHolidaysDefault}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 658 | 2 | ▶ | $holidayCal = $task->{skipHolidaysDefault} if ($task->{skipForFirstBusinessDate} eq "1" or $task->{skipHolidays} eq "1"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$task->{"skipForFirstBusinessDate"} eq 1 or $task->{"skipHolidays"} eq 1
MC/DC0%0/2
$task->{"skipForFirstBusinessDate"} eq 1 or $task->{"skipHolidays"} eq 1
$task->{"skipForFirstBusinessDate"} eq 1
$task->{"skipHolidays"} eq 1
Truth table33%1/3
A or B
A= $task->{"skipForFirstBusinessDate"} eq 1B= $task->{"skipHolidays"} eq 1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 659 | 2 | ▶ | if ($holidayCal) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 660 | 1 | ▶ | if (is_holiday($holidayCal,$curdate) and !$task->{redoFile}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
&is_holiday($holidayCal, $curdate) and not $task->{"redoFile"}
MC/DC0%0/2
&is_holiday($holidayCal, $curdate) and not $task->{"redoFile"}
&is_holiday($holidayCal, $curdate)
not $task->{"redoFile"}
Truth table33%1/3
A and not(B)
A= &is_holiday($holidayCal, $curdate)B= not $task->{"redoFile"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 661 | 1 | $logger->info("skip processing (skipHolidays = ".$task->{skipHolidays}.", skipForFirstBusinessDate = ".$task->{skipForFirstBusinessDate}.") as $curdate holiday in $holidayCal !"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 662 | 1 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 663 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 664 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 665 | 1 | ▶ | if (($task->{skipWeekends} or $task->{skipForFirstBusinessDate}) and is_weekend($curdate) and !$task->{redoFile}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%3/9
$task->{"skipWeekends"} || $task->{"skipForFirstBusinessDate"} and &is_weekend($curdate) and not $task->{"redoFile"}
$task->{"skipWeekends"} || $task->{"skipForFirstBusinessDate"} and &is_weekend($curdate)
$task->{"skipWeekends"} or $task->{"skipForFirstBusinessDate"}
MC/DC0%0/4
$task->{"skipWeekends"} || $task->{"skipForFirstBusinessDate"} and &is_weekend($curdate) and not $task->{"redoFile"}
$task->{"skipWeekends"}
$task->{"skipForFirstBusinessDate"}
&is_weekend($curdate)
not $task->{"redoFile"}
Truth table14%1/7
A or B and C and not(D)
A= $task->{"skipWeekends"}B= $task->{"skipForFirstBusinessDate"}C= &is_weekend($curdate)D= not $task->{"redoFile"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 666 | 0 | $logger->info("skip processing (skipWeekends = ".$task->{skipWeekends}.", skipForFirstBusinessDate = ".$task->{skipForFirstBusinessDate}.") as $curdate is day of weekend !"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 667 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 668 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 669 | # if there are were any business days (meaning that nonBusinessDays are less than calendar days) since the 1st of the month, then skip if $task->{skipForFirstBusinessDate} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 670 | 1 | ▶ | if ($task->{skipForFirstBusinessDate} and !$task->{redoFile}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$task->{"skipForFirstBusinessDate"} and not $task->{"redoFile"}
MC/DC0%0/2
$task->{"skipForFirstBusinessDate"} and not $task->{"redoFile"}
$task->{"skipForFirstBusinessDate"}
not $task->{"redoFile"}
Truth table33%1/3
A and not(B)
A= $task->{"skipForFirstBusinessDate"}B= not $task->{"redoFile"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 671 | 0 | my $nonBusinessDays; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 672 | 0 | my $daysfrom1st = substr($curdate,-2)-1; # get the first decimal from day part of today, this is the number of days from the 1st | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 673 | # count non business days since the 1st of the month | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 674 | 0 | for (1..$daysfrom1st) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 675 | 0 | ▶ | $nonBusinessDays += (is_weekend(subtractDays($curdate,$_)) or is_holiday($holidayCal,subtractDays($curdate,$_))); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
&is_weekend(scalar &subtractDays($curdate, $_)) || &is_holiday($holidayCal, scalar &subtractDays($curdate, $_))
MC/DC0%0/2
&is_weekend(scalar &subtractDays($curdate, $_)) || &is_holiday($holidayCal, scalar &subtractDays($curdate, $_))
&is_weekend(scalar &subtractDays($curdate, $_))
&is_holiday($holidayCal, scalar &subtractDays($curdate, $_))
Truth table0%0/3
A || B
A= &is_weekend(scalar &subtractDays($curdate, $_))B= &is_holiday($holidayCal, scalar &subtractDays($curdate, $_))
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 676 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 677 | 0 | $logger->debug("\$nonBusinessDays: $nonBusinessDays,\$daysfrom1st: $daysfrom1st"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 678 | 0 | ▶ | if ($nonBusinessDays < $daysfrom1st) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 679 | 0 | $logger->info("skip processing (skipForFirstBusinessDate = ".$task->{skipForFirstBusinessDate}.") as processing already took place on a business day before $curdate!"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 680 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 681 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 682 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 683 | # if notest file exists, then exit here if not set to ignore that... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 684 | 1 | ▶ | if (!$task->{ignoreNoTest} and -e "notest") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not $task->{"ignoreNoTest"} and -e "notest"
MC/DC0%0/2
not $task->{"ignoreNoTest"} and -e "notest"
not $task->{"ignoreNoTest"}
-e "notest"
Truth table33%1/3
not(A) and B
A= not $task->{"ignoreNoTest"}B= -e "notest"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 685 | 0 | $logger->info("skip processing, because notest set (file exists)."); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 686 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 687 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 688 | 1 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 689 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 690 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 691 | # general mail sending for notifying of conditions/sending reports (for use in user specific code) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 692 | 0 | ▶ | sub sendGeneralMail ($$$$$$;$$$$$) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
sendGeneralMail: not called CC=33 SCAR=70.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 693 | 0 | my ($From, $To, $Cc, $Bcc, $Subject, $Data, $Type, $Encoding, $AttachType, $AttachFile, $enforceToAddressInTest) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 694 | 0 | my $logger = get_logger(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 695 | 0 | ▶ | $logger->error("cannot send mail as \$config{smtpServer} not set".longmess()) if !$config{smtpServer}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 696 | 0 | ▶ | $logger->info("sending general mail From:".($From ? $From : $config{fromaddress}).", To:".($execute{envraw} && !$enforceToAddressInTest ? $config{testerrmailaddress} : $To).", CC:".($execute{envraw} ? "" : $Cc).", Bcc:".($execute{envraw} ? "" : $Bcc).", Subject:".($execute{envraw} ? $execute{envraw}.": " : "").$Subject.", Type:".($Type ? $Type : "TEXT").", Encoding:".($Type eq 'multipart/related' ? undef : $Encoding)."AttachType: $AttachType, AttachFile: $AttachFile, enforceToAddressInTest: $enforceToAddressInTest"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 7 branches
Condition0%0/3
$EAI::Common::execute{"envraw"} and not $enforceToAddressInTest
MC/DC0%0/2
$EAI::Common::execute{"envraw"} and not $enforceToAddressInTest
$EAI::Common::execute{"envraw"}
not $enforceToAddressInTest
Truth table0%0/3
A and not(B)
A= $EAI::Common::execute{"envraw"}B= not $enforceToAddressInTest
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 697 | 0 | $logger->debug("Mailbody: $Data"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 698 | my $msg = MIME::Lite->new( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 699 | From => ($From ? $From : $config{fromaddress}), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 700 | To => ($execute{envraw} && !$enforceToAddressInTest ? $config{testerrmailaddress} : $To), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 701 | Cc => ($execute{envraw} ? "" : $Cc), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 702 | Bcc => ($execute{envraw} ? "" : $Bcc), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 703 | 0 | ▶ | Subject => ($execute{envraw} ? $execute{envraw}.": " : "").$Subject, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 8 branches
Condition0%0/3
$EAI::Common::execute{"envraw"} and not $enforceToAddressInTest
MC/DC0%0/2
$EAI::Common::execute{"envraw"} and not $enforceToAddressInTest
$EAI::Common::execute{"envraw"}
not $enforceToAddressInTest
Truth table0%0/3
A and not(B)
A= $EAI::Common::execute{"envraw"}B= not $enforceToAddressInTest
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 704 | Type => ($Type ? $Type : "TEXT"), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 705 | Data => ($Type eq 'multipart/related' ? undef : $Data), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 706 | Encoding => ($Type eq 'multipart/related' ? undef : $Encoding), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 707 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 708 | 0 | ▶ | $logger->error("couldn't create msg for mail sending..".longmess()) unless $msg; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 709 | 0 | ▶ | if ($Type eq 'multipart/related') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 710 | 0 | ▶ | if (ref($AttachFile) ne 'ARRAY') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 711 | 0 | $logger->error("argument $AttachFile needs to be ref to array for type multipart/related".longmess()); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 712 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 713 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 714 | 0 | ▶ | if (!$AttachType) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 715 | 0 | $logger->error("no AttachType given for type multipart/related".longmess()); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 716 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 717 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 718 | $msg->attach( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 719 | 0 | Type => 'text/html', | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 720 | Data => $Data, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 721 | Encoding => $Encoding | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 722 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 723 | 0 | for (@$AttachFile) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 724 | 0 | $msg->attach( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 725 | Encoding => 'base64', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 726 | Type => $AttachType, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 727 | Path => $_, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 728 | Id => $_, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 729 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 730 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 731 | ▶ | } elsif ($AttachFile and $AttachType) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$AttachFile and $AttachType
MC/DC0%0/2
$AttachFile and $AttachType
$AttachFile
$AttachType
Truth table0%0/3
A and B
A= $AttachFileB= $AttachType
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 732 | 0 | ▶ | if (ref($AttachFile) ne 'ARRAY') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 733 | 0 | $msg->attach( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 734 | Type => $AttachType, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 735 | Id => $AttachFile, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 736 | Path => $AttachFile | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 737 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 738 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 739 | 0 | for (@$AttachFile) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 740 | 0 | $msg->attach( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 741 | Type => $AttachType, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 742 | Path => $_, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 743 | Id => $_, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 744 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 745 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 746 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 747 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 748 | 0 | ▶ | if ($AttachFile and !$AttachType) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$AttachFile and not $AttachType
MC/DC0%0/2
$AttachFile and not $AttachType
$AttachFile
not $AttachType
Truth table0%0/3
A and not(B)
A= $AttachFileB= not $AttachType
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 749 | 0 | $logger->error("no AttachType given for attachment $AttachFile".longmess()); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 750 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 751 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 752 | 0 | ▶ | eval {$msg->send('smtp', $config{smtpServer})} or $logger->error("\$msg->send failed: $@".longmess()); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 753 | 0 | ▶ | if ($msg->last_send_successful()) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 754 | 0 | $logger->info("Mail sent"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 755 | 0 | ▶ | $logger->trace("sent message: ".$msg->as_string) if $logger->is_trace(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 756 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 757 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 758 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 759 | package Log::Dispatch::Email::LogSender; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 760 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 761 | 3 | ▶ | use feature 'unicode_strings'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 762 | 3 | ▶ | use Log::Dispatch::Email; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 763 | 3 | ▶ | use base qw( Log::Dispatch::Email ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 764 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 765 | 0 | ▶ | sub send_email { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
send_email: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 766 | 0 | my ($self, %p) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 767 | # catch wide non utf8 characters to avoid die in MIME::Lite | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 768 | #eval {decode('UTF-8',$p{message},$Encode::FB_confess )} or $p{message} =~ s/[^\x00-\x7f]/?/g; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 769 | my $msg = MIME::Lite->new( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 770 | From => $self->{from}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 771 | 0 | To => ( join ',', @{ $self->{to} } ), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 772 | Subject => $self->{subject}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 773 | Type => "TEXT", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 774 | Data => $p{message}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 775 | 0 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 776 | 0 | ▶ | eval {$msg->send();} or warn("couldn't send error mail: $@"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 777 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 778 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 779 | 3 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 780 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||