# SCCS ID: @(#).perl_wrapper 1.1 02/03/99
# Cloned from .common_tool_wrapper
echo "WRAPPER: $TRE_PROJECT/tools/bin/perl_wrapper"
echo "SYS: "`uname -s` `uname -r`
echo "TRE_SEARCH: "$TRE_SEARCH
echo "TRE_ENTRY: "$TRE_ENTRY
echo "Subject: TRE ERROR"
# Log to TRE_LOG if it is set properly.
# It is STRONGLY recommended that TRE_LOG be an e-mail address
# in order to avoid problems with several people simultanously
# writing to the same file.
# TRE_LOG must be set, but it can be broken.
# TRE_ULOG is optional, for users who want their own logging.
if [ ! -z "$TRE_LOG_ENABLED" ] ; then
if [ ! -z "$TRE_LOG" ] ; then
# Check first if TRE_LOG is a file (this is cheap).
if [ -f $TRE_LOG -a -w $TRE_LOG ] ; then
elif /usr
/lib
/sendmail
-bv $TRE_LOG 1>&- 2>&- ; then
mailinfo
$TRE_LOG |
/usr
/lib
/sendmail
$TRE_LOG
mailerr
$user "Can't log to TRE_LOG=$TRE_LOG. Fix environment." |
/usr
/lib
/sendmail
$user
die
"TRE_LOG environment variable is not set."
# TRE_ULOG is optional user log. EMAIL address is recommended.
if [ ! -z "$TRE_ULOG" ] ; then
# Check first if TRE_ULOG is a file (this is cheap).
if [ -f $TRE_ULOG -a -w $TRE_ULOG ] ; then
elif /usr
/lib
/sendmail
-bv $TRE_ULOG 1>&- 2>&- ; then
mailinfo
$TRE_ULOG |
/usr
/lib
/sendmail
$TRE_ULOG
mailerr
$user "Can't log to TRE_ULOG=$TRE_ULOG. Fix environment." |
/usr
/lib
/sendmail
$user
echo "$tool -> perl_wrapper: $message Exiting ..."
if [ ! -z "$TRE_LOG" ] ; then
if [ -f ${TRE_LOG} -a -w ${TRE_LOG} ] ; then
echo "ERROR: $message" >> $TRE_LOG
elif /usr
/lib
/sendmail
-bv $TRE_LOG 1>&- 2>&- ; then
mailerr
$TRE_LOG "$message" |
/usr
/lib
/sendmail
$TRE_LOG
echo "Can not log to TRE_LOG=${TRE_LOG}. Logging to '$user.'"
mailerr
$user "$message" |
/usr
/lib
/sendmail
$user
# TRE_ULOG is optional user log. EMAIL address is recommended.
if [ ! -z "$TRE_ULOG" ] ; then
if [ -f ${TRE_ULOG} -a -w ${TRE_ULOG} ] ; then
echo "ERROR: $message" >> $TRE_ULOG
elif /usr
/lib
/sendmail
-bv $TRE_ULOG 1>&- 2>&- ; then
mailerr
$TRE_ULOG "$message" |
/usr
/lib
/sendmail
$TRE_ULOG
echo "Can not log to TRE_ULOG=${TRE_ULOG}. Logging to '$user.'"
mailerr
$user "$message" |
/usr
/lib
/sendmail
$user
############################ main ##############################
if [ -z "$TRE_PROJECT" ]; then
die
"TRE_PROJECT not defined"
TRE_ROOT
=$TRE_PROJECT/tools
/perlmod
### Verify TRE_SEARCH and TRE_ENTRY are defined and non-null
if [ -z "$TRE_SEARCH" ]; then
die
"TRE_SEARCH not defined"
if [ -z "$TRE_ENTRY" ]; then
die
"TRE_ENTRY not defined"
### Get version, based on tool invoked, and $TRE_ENTRY
if [ $tool = "configsrch" ] ; then
version
=`configsrch $tool $TRE_ENTRY 2>&1`
die
"configsrch returned error code $stat"
### Verify configsrch delivered a non-null version
if [ -z "$version" ]; then
die
"No version set by configsrch"
### Assemble do-file name. If it's there, execute and test status.
exe
=$TRE_ROOT/$tool,$version.
do
die
"Error return from do file"
if [ $OS = "SunOS" ] ; then
if [ $OS = "Linux" ]; then
if [ -z "$PERL_VER" ] ; then
if [ -z "$PERL5OPT" ] ; then
PERL5OPT
="-I$PERL_MODULE_BASE -I$PERL_MODULE_BASE/$OS-$CPU"
PERL5OPT
="-I$PERL_MODULE_BASE -I$PERL_MODULE_BASE/$OS-$CPU $PERL5OPT"
if [ -z "$PERL5OPT" ] ; then
PERL5OPT
="-I$PERL_MODULE_BASE -I$PERL_MODULE_BASE/$OS-$CPU -I$PERL5_PATH/$PERL_VER -I$PERL5_PATH/$PERL_VER/sun4-solaris"
PERL5OPT
="-I$PERL_MODULE_BASE -I$PERL_MODULE_BASE/$OS-$CPU -I$PERL5_PATH/$PERL_VER -I$PERL5_PATH/$PERL_VER/sun4-solaris $PERL5OPT"
exe
=$TRE_ROOT/$tool,$version
die
"executable $exe not found!"