#!/bin/sh
# Execute perl after putting some Splus directories into @INC

if test "$SHOME" = "" ; then
  echo "$0: SHOME is not set (use Splus $0)" 1>&2
  exit 1
fi

S_PERL=${S_PERL-"perl"}

if test -n "${S_USER_APPDATA_DIR}" ; then
  S_PERLLIB=${S_PERLLIB-"$SHOME"/share/perl:"$S_USER_APPDATA_DIR"/library/pkgutils/share/perl:"$SHOME"/library/pkgutils/share/perl}
else
  S_PERLLIB=${S_PERLLIB-"$SHOME"/share/perl:"$SHOME"/library/pkgutils/share/perl}
fi

if test -n "${PERL5LIB}" ; then
  PERL5LIB="${S_PERLLIB}":"${PERL5LIB}"
  export PERL5LIB
elif test -n "${PERLLIB}"; then
  PERLLIB="${S_PERLLIB}":"${PERLLIB}"
  export PERLLIB
else
  PERLLIB="${S_PERLLIB}"
  export PERLLIB
fi

exec ${S_PERL} "$@"
