Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Perl version changes? [duplicate]

Tags:

cgi

perl

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)

like image 632
Jean-François MORFIN Avatar asked Jun 26 '26 06:06

Jean-François MORFIN


1 Answers

They removed the current directory (.) from @INC in Perl 5.26.

The link above includes some solutions:

  • You can set the PERL_USE_UNSAFE_INC environment variable to 1.
  • Manually add your secure path to @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;
like image 126
Jim Davis Avatar answered Jun 28 '26 14:06

Jim Davis



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!