I wrote some perl cgis 20 years ago. They worked perfectly ... until my hosting company has updated my machine last week. A Perl cgi blocks. It seems it is because the following sequence :
require "quiest.htm";
require "quiest.pay";
require "quiest.ent";
is not understood as meaning "use these three scripts in the same directory" anymore.
Which would be the correct entry?
I tried quite everything else in terms of reloads, site reorganizing, etc. (the script is called by an HTML page requesting a user entry) everything resulted in a "site.tld\nameof.cgi?string=xxxxx 404)
They removed the current directory (.) from @INC in Perl 5.26.
The link above includes some solutions:
PERL_USE_UNSAFE_INC environment variable to 1.@INC:BEGIN {
my $dir = "/some/trusted/directory";
chdir $dir or die "Can't chdir to $dir: $!\n";
# safe now
push @INC, '.';
}
Also, as @ikegami reminded me in the comments, FindBin exists:
use FindBin;
use lib $FindBin::Bin;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With