diff --git a/four_million.pl b/four_million.pl index 809b27aa..72bcccd4 100755 --- a/four_million.pl +++ b/four_million.pl @@ -17,13 +17,12 @@ package main; # Un-buffer output $| = 1; - # 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::Utils; diff --git a/hires_cxreport.pl b/hires_cxreport.pl index 19112aec..bb7e20da 100755 --- a/hires_cxreport.pl +++ b/hires_cxreport.pl @@ -9,12 +9,12 @@ if (defined $ENV{DEBUG}) { } use Time::HiRes qw(usleep ualarm gettimeofday stat lstat utime); #use Time::Format qw/%time/; -if ( -f "./LANforge/Utils.pm" ) { - use lib '.'; -} -elsif ( -f "/home/lanforge/scripts/LANforge/Utils.pm" ) { - use lib "/home/lanforge/scripts/LANforge"; -} + +# 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 LANforge::Utils; use Net::Telnet (); use Getopt::Long; diff --git a/json/check_ports.pl b/json/check_ports.pl index 35b1b957..c3fdb393 100755 --- a/json/check_ports.pl +++ b/json/check_ports.pl @@ -17,6 +17,8 @@ use LWP::UserAgent; use Data::Dumper; use JSON; use lib '/home/lanforge/scripts'; +use lib "../"; +use lib "./"; use LANforge::JsonUtils qw(logg err json_request get_links_from get_thru json_post get_port_names flatten_list); package main; diff --git a/json/cx_test_allsta.pl b/json/cx_test_allsta.pl index b7306c63..293c4d8c 100755 --- a/json/cx_test_allsta.pl +++ b/json/cx_test_allsta.pl @@ -16,6 +16,8 @@ use LWP::UserAgent; use Data::Dumper; use JSON; use lib '/home/lanforge/scripts'; +use lib "../"; +use lib "./"; use LANforge::JsonUtils qw(logg err json_request get_links_from get_thru json_post get_port_names); package main; diff --git a/json/cx_test_allsta_para.pl b/json/cx_test_allsta_para.pl index 4c5276c2..0375aa7e 100755 --- a/json/cx_test_allsta_para.pl +++ b/json/cx_test_allsta_para.pl @@ -23,6 +23,8 @@ use Time::HiRes qw(usleep nanosleep); use Proc::Background; use lib '/home/lanforge/scripts'; +use lib "../"; +use lib "./"; use LANforge::JsonUtils qw(logg err json_request get_links_from get_thru json_post get_port_names); package main; diff --git a/json/cx_test_helper.pl b/json/cx_test_helper.pl index c25ef3b4..da348893 100755 --- a/json/cx_test_helper.pl +++ b/json/cx_test_helper.pl @@ -17,6 +17,8 @@ use Data::Dumper; use JSON; use Linux::Inotify2; use lib '/home/lanforge/scripts'; +use lib "../"; +use lib "./"; use LANforge::JsonUtils qw(logg err json_request get_links_from get_thru json_post get_port_names); package main; diff --git a/json/dut_test.pl b/json/dut_test.pl index e3204093..67d9e836 100755 --- a/json/dut_test.pl +++ b/json/dut_test.pl @@ -17,6 +17,8 @@ use Data::Dumper; use Time::HiRes qw(usleep); use JSON; use lib '/home/lanforge/scripts'; +use lib "../"; +use lib "./"; use LANforge::JsonUtils qw(logg err json_request get_links_from get_thru json_post get_port_names flatten_list); package main; @@ -188,4 +190,4 @@ if ($action eq "annotate") { json_post($post_uri, $rh); } } -# \ No newline at end of file +# diff --git a/json/l4_test.pl b/json/l4_test.pl index 79adc841..bd98e64b 100755 --- a/json/l4_test.pl +++ b/json/l4_test.pl @@ -17,6 +17,8 @@ use Data::Dumper; use Time::HiRes qw(usleep); use JSON; use lib '/home/lanforge/scripts'; +use lib "../"; +use lib "./"; use LANforge::JsonUtils qw(logg err json_request get_links_from get_thru json_post get_port_names flatten_list); package main; diff --git a/json/port_test.pl b/json/port_test.pl index 5bf0a847..3c98b114 100755 --- a/json/port_test.pl +++ b/json/port_test.pl @@ -17,6 +17,8 @@ use LWP::UserAgent; use Data::Dumper; use JSON; use lib '/home/lanforge/scripts'; +use lib "../"; +use lib "./"; use LANforge::JsonUtils qw(logg err json_request get_links_from get_thru json_post get_port_names flatten_list); package main; diff --git a/json/port_toggle_test.pl b/json/port_toggle_test.pl index 9b21c154..3eecf948 100755 --- a/json/port_toggle_test.pl +++ b/json/port_toggle_test.pl @@ -17,6 +17,8 @@ use LWP::UserAgent; use Data::Dumper; use JSON; use lib '/home/lanforge/scripts'; +use lib "../"; +use lib "./"; use LANforge::JsonUtils qw(logg err json_request get_links_from get_thru json_post get_port_names); package main; diff --git a/json/set_port_aliases.pl b/json/set_port_aliases.pl index 44cd8a07..bb8dda3b 100755 --- a/json/set_port_aliases.pl +++ b/json/set_port_aliases.pl @@ -17,6 +17,8 @@ use LWP::UserAgent; use Data::Dumper; use JSON; use lib '/home/lanforge/scripts'; +use lib "../"; +use lib "./"; use LANforge::JsonUtils qw(logg err json_request get_links_from get_thru json_post get_port_names flatten_list); package main; diff --git a/json/test_sta_mode.pl b/json/test_sta_mode.pl index 4357b957..e284dd9e 100755 --- a/json/test_sta_mode.pl +++ b/json/test_sta_mode.pl @@ -17,6 +17,8 @@ use LWP::UserAgent; use Data::Dumper; use JSON; use lib '/home/lanforge/scripts'; +use lib "../"; +use lib "./"; use LANforge::JsonUtils qw(err logg xpand json_request); @@ -57,4 +59,4 @@ for my $rh_e (@{$rh->{interfaces}}) { sleep 0.1; } -# \ No newline at end of file +# diff --git a/l3_vid_group.pl b/l3_vid_group.pl index 9d554745..caf51fd7 100755 --- a/l3_vid_group.pl +++ b/l3_vid_group.pl @@ -14,12 +14,12 @@ $SIG{ __DIE__ } = sub { Carp::confess( @_ ) }; $SIG{ __WARN__ } = sub { Carp::confess( @_ ) }; # Un-buffer output $| = 1; -if (-f "LANforge/Endpoint.pm" ) { - use lib "./"; -} -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 LANforge::Endpoint; use LANforge::Port; use LANforge::Utils; diff --git a/l3_video_em.pl b/l3_video_em.pl index 81aff9ce..caa3c99f 100755 --- a/l3_video_em.pl +++ b/l3_video_em.pl @@ -10,12 +10,12 @@ use Data::Dumper; # Un-buffer output $| = 1; -if ( -f "LANforge/Endpoint.pm" ) { - use lib "./"; -} -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 LANforge::Endpoint; use LANforge::Port; use LANforge::Utils; diff --git a/lf_associate_ap.pl b/lf_associate_ap.pl index 8a479a53..9623f838 100755 --- a/lf_associate_ap.pl +++ b/lf_associate_ap.pl @@ -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; diff --git a/lf_auto_wifi_cap.pl b/lf_auto_wifi_cap.pl index cb74ee0f..f6a87859 100755 --- a/lf_auto_wifi_cap.pl +++ b/lf_auto_wifi_cap.pl @@ -13,7 +13,12 @@ use Carp; # Un-buffer output $| = 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 lib "./"; + use LANforge::Endpoint; use LANforge::Port; use LANforge::Utils; diff --git a/lf_create_bcast.pl b/lf_create_bcast.pl index ca72c936..43ae031c 100755 --- a/lf_create_bcast.pl +++ b/lf_create_bcast.pl @@ -6,7 +6,12 @@ $SIG{ __DIE__ } = sub { Carp::confess( @_ ) }; # Un-buffer output $| = 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 lib "./"; + use LANforge::Endpoint; use LANforge::Port; use LANforge::Utils; diff --git a/lf_endp_script.pl b/lf_endp_script.pl index 13f68f67..e5b6a827 100755 --- a/lf_endp_script.pl +++ b/lf_endp_script.pl @@ -11,7 +11,12 @@ use warnings; # Un-buffer output $| = 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 lib "./"; + use LANforge::Endpoint; use LANforge::Port; use LANforge::Utils; diff --git a/lf_firemod.pl b/lf_firemod.pl index 33ac946c..b780a4d2 100755 --- a/lf_firemod.pl +++ b/lf_firemod.pl @@ -15,12 +15,12 @@ $SIG{ __WARN__ } = sub { Carp::confess( @_ ) }; # Un-buffer output $| = 1; -if (-f "LANforge/Endpoint.pm" ) { - use lib "./"; -} -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 LANforge::Endpoint; use LANforge::Port; use LANforge::Utils; diff --git a/lf_generic_ping.pl b/lf_generic_ping.pl index 739f2119..a7453c6c 100755 --- a/lf_generic_ping.pl +++ b/lf_generic_ping.pl @@ -33,7 +33,12 @@ $SIG{ __WARN__ } = sub { Carp::confess( @_ )}; use Getopt::Long; use Cwd qw(getcwd); my $cwd = getcwd(); + +# 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; diff --git a/lf_ice.pl b/lf_ice.pl index ece15a5c..4994d803 100755 --- a/lf_ice.pl +++ b/lf_ice.pl @@ -16,14 +16,11 @@ $SIG{ __WARN__ } = sub { Carp::confess( @_ ) }; # Un-buffer output $| = 1; -if ( -d "./LANforge" ) { - use lib "."; - use lib "./LANforge"; -} -elsif ( -d "/home/lanforge/scripts/LANforge") { - use lib "/home/lanforge/scripts"; - use lib "/home/lanforge/scripts/LANforge"; -} +# 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 LANforge::Endpoint; use LANforge::Port; use LANforge::Utils; diff --git a/lf_icemod.pl b/lf_icemod.pl index a5d995e3..f6ec3d5a 100755 --- a/lf_icemod.pl +++ b/lf_icemod.pl @@ -19,14 +19,10 @@ our $Q = q("); # Un-buffer output $| = 1; -if ( -d "./LANforge" ) { - use lib "."; - use lib "./LANforge"; -} -elsif ( -d "/home/lanforge/scripts/LANforge" ) { - use lib "/home/lanforge/scripts"; - use lib "/home/lanforge/scripts/LANforge"; -} +# 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 LANforge::Endpoint; use LANforge::Port; diff --git a/lf_l4_auth.pl b/lf_l4_auth.pl index 7918cab6..9691268c 100755 --- a/lf_l4_auth.pl +++ b/lf_l4_auth.pl @@ -11,7 +11,12 @@ use strict; use warnings; use Carp; $| = 1;# Un-buffer output + +# 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 Getopt::Long; use LANforge::Endpoint; use LANforge::Port; diff --git a/lf_many_conn.pl b/lf_many_conn.pl index 97db49f2..3dd9c54a 100755 --- a/lf_many_conn.pl +++ b/lf_many_conn.pl @@ -23,7 +23,11 @@ use diagnostics; # Un-buffer output $| = 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 lib "./"; + use LANforge::Endpoint; use LANforge::Port; use LANforge::Utils; diff --git a/lf_portmod.pl b/lf_portmod.pl index d34653df..17a0670c 100755 --- a/lf_portmod.pl +++ b/lf_portmod.pl @@ -32,16 +32,11 @@ $| = 1; use Cwd qw(getcwd); my $cwd = getcwd(); - # this is pedantic necessity for the following use statements -if ( -f "LANforge/Endpoint.pm" ) { - use lib "./"; -} -elsif ( $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 LANforge::Endpoint; use LANforge::Port; use LANforge::Utils;