use constant { TRUE => 1, FALSE => 0 };
our $SUCCESS = 0;
our %ErrorStrings = (
"No such file or directory" => TRUE,
"does not exist in file" => TRUE,
);
# Run command.
@Output = qx { command here 2>&1 };
$RetCode1=$?;
# If the return was success, we need to scan the output for errors.
if ($RetCode1 == $SUCCESS) {
# Scan the output and build a list of errors.
my @FileErrors = grep { exists $ErrorStrings{$_} } @Output;
if (@FileErrors) {
$RetCode1 = scalar(@FileErrors);
printf "Errors found: [%d] ", $RetCode1;
push (@ProcErrors, @FileErrors);
}
# Non success error code.
} else { printf "Error Code: [%d] ", $RetCode1; }
# Output a status.
printf "%-15s\n",
($RetCode1 == 0) ? "SUCCESS":"FAILED";
####
Processing A_Ra -> A/R ... SUCCESS
Processing ADDRESS -> ADDRESS ... SUCCESS
Processing ADJ-HIST -> ADJ-HIST ... SUCCESS
Processing ALT-PN -> ALT-PN ... SUCCESS
Processing AR-LEDGER -> AR-LEDGER ... SUCCESS
Processing AR_LEVEL -> AR/LEVEL ... SUCCESS
Processing BCBI -> BCBI ... SUCCESS
Processing BID -> BID ... SUCCESS
Processing BUDGET -> BUDGET ... SUCCESS
Processing BUDGET_HEADER -> BUDGET/HEADER ... SUCCESS
####
'XORDER' does not exist in file.
Open file error.