Fix perl use of 'use lib'

The 'use lib' logic happens in the pre-compile stage, so one cannot
use normal 'if' logic to use a particular INC.  Instead, just make sure
that best dir is added to 'use lib' last since it prepends to INC.
This commit is contained in:
Ben Greear
2020-03-04 16:35:47 -08:00
parent 45b4512ba2
commit d824eb2e66
25 changed files with 100 additions and 66 deletions

View File

@@ -74,13 +74,11 @@ $| = 1;
use Cwd qw(getcwd);
my $cwd = getcwd();
# this is pedantic necessity for the following use statements
if ( $cwd =~ q(.*LANforge-Server\scripts$)) {
use lib '/home/lanforge/scripts'
}
else {
use lib '/home/lanforge/scripts';
}
# use lib prepends to @INC, so put lower priority first
# This is before run-time, so cannot condition this with normal 'if' logic.
use lib '/home/lanforge/scripts';
use lib "./";
use List::Util qw(first);
use LANforge::Endpoint;
use LANforge::Port;