Professional Documents
Culture Documents
/usr/bin/perl
# $Header:
# Use a pragma that restricts use of unsafe constructs, such as symbolic
# references, barewords, and undeclared variables.
# This pragma is part of the standard Perl library.
use strict;
# Use a module that allows English-like words to be used in place of
# Perl's special variables aka punctuation variables.
# This module is part of the standard Perl library.
use English;
# Use a module for file copying.
# This module is part of the standard Perl library.
use File::Copy qw(cp mv);
# Use a module for parsing file specifications into useful pieces.
# This module is part of the standard Perl library.
use File::Basename;
if ( $inout eq '-i' ) {
$CONFIG_PARAMS{"INBOUND"}="true";
} else {
$CONFIG_PARAMS{"INBOUND"}="false";
}
unless (open FILE , "< $0.conf") {
Println ("ERROR : Could not open $0.conf configuration file");
exit 1;
}
# parse the config file
while (<FILE>) {
# remove leading spaces
$_ =~ s/^\s+//g;
# remove trailing spaces
$_ =~ s/\s+$//g;
# ignore comments
next if $_ =~ /^#/;
my @params = split /=/ , $_;
$CONFIG_PARAMS{$params[0]}=$params[1];
}
my $date = strftime '%Y%m%d', localtime;
my $logdir = $CONFIG_PARAMS{'LOG_DIR'};
$logdir = $logdir . "/" if $logdir !~ /\/$/;
my $log = $logdir . $date . '.log';
open LOGS , ">> $log" or die "ERROR : Couldn't open $log for writing/appending.
$!\n";
my $AI_QUEUEID = $ENV{'OT_QUEUEID'};
my $OT_DIR = $ENV{'OT_DIR'};
unless (Translate(\%CONFIG_PARAMS)) {
Println "Translation was not successful, check logs for more details";
exit 1;
}
close LOGS;
my @files = readdir(DIR);
if (scalar @files - 2 == 0) {
Println "ERROR : No files exist in $dir , no translation performed"; retur
n 1;
}
Println "Total files found " . scalar @files - 2 if $debug;
# archive date time stamp
my $archdts = strftime('%Y%m%d%H%M%S', localtime);
if ($CONFIG_PARAMS->{'INBOUND'} eq 'true') {
if ($error_flag eq 'y') {