From: Colin Campbell Date: Tue, 19 Jun 2012 10:24:01 +0000 (+0100) Subject: Bug 8271 teach SIPServer.pm to set its own lib path X-Git-Url: http://git.rot13.org/?p=koha.git;a=commitdiff_plain;h=8e485c6112756f3fe8404d9d4d700535f0e87306 Bug 8271 teach SIPServer.pm to set its own lib path SIPServer.pm requires that C4/SIP is added to its lib path This has been done by passing this directory to it via -I. By using FindBin it can set the path for itself correctly. This will also work if the C4/SIP directory tree is moved to a non-standard location Removed the now redundant -I. from sip_run.sh Added a variable to sip_run.sh for the koha tree to highlight a problem with the script if you have multiple directories in the PERL5LIB environment variable Signed-off-by: Chris Cormack Signed-off-by: Paul Poulain --- diff --git a/C4/SIP/SIPServer.pm b/C4/SIP/SIPServer.pm index 4e714b3026..44c58b42f0 100644 --- a/C4/SIP/SIPServer.pm +++ b/C4/SIP/SIPServer.pm @@ -2,6 +2,8 @@ package SIPServer; use strict; use warnings; +use FindBin qw($Bin); +use lib "$Bin"; # use Exporter; use Sys::Syslog qw(syslog); use Net::Server::PreFork; diff --git a/misc/bin/sip_run.sh b/misc/bin/sip_run.sh index b1bc8d9c43..d270544f18 100755 --- a/misc/bin/sip_run.sh +++ b/misc/bin/sip_run.sh @@ -24,7 +24,10 @@ for x in HOME PERL5LIB KOHA_CONF ; do fi; done; unset x; -cd $PERL5LIB/C4/SIP; +# you should hard code this if you have multiple directories +# in your PERL5LIB +PERL_MODULE_DIR=$PERL5LIB +cd $PERL_MODULE_DIR/C4/SIP; echo; sipconfig=${1}; @@ -34,8 +37,8 @@ errfile=${3:-$HOME/sip.err}; if [ $sipconfig ]; then echo "Running with config file located in $sipconfig" ; echo "Calling (backgrounded):"; - echo "perl -I./ ./SIPServer.pm $sipconfig >>$outfile 2>>$errfile"; - perl -I./ ./SIPServer.pm $sipconfig >>$outfile 2>>$errfile & + echo "perl ./SIPServer.pm $sipconfig >>$outfile 2>>$errfile"; + perl ./SIPServer.pm $sipconfig >>$outfile 2>>$errfile & else echo "Please specify a config file and try again."