firemod: Attempt to fix INC path issue.

On my system that does not have the directory /home/lanforge/scripts, the
lf_firemod.pl would fail saying it cannot find Net::Telnet, even though it
is installed.

The problem turns out to be that if you have "use lib foo" and foo does not exist,
or is not readable, then perl craps out immediately instead of trying other
places in @INC.  I think this 'use if' logic fixes that issue based on
internet reading.  It fixes the issue on my system, but I'm not certain
it works properly on systems that do depend on /home/lanforge/scripts/
existing, so that will need some more testing.

Signed-off-by: Ben Greear <greearb@candelatech.com>
This commit is contained in:
Ben Greear
2020-08-29 13:13:21 -07:00
parent a79a32dc7a
commit fc24fffbe2

View File

@@ -18,7 +18,7 @@ $| = 1;
# 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 if (-e "/home/lanforge/scripts"), lib => "/home/lanforge/scripts";
use lib "../";
use lib "./";