Address @INC issues to Perl 5.26 before upgrading

In Perl 5.26, a security issue removes the "." (Current directory) from the module's include path.

Charsbar's article is detailed on this issue.

Address this issue before upgrading to Perl 5.26

As for the CPAN module, it seems to address this issue, so it's the script you're using that needs to be fixed.

Even in my company, some old CGI scripts are still running. After a little research, it seemed that some scripts needed to be modified before upgrading to Perl 5.26. There are some that have jcode.pl and cgi-lib.pl loaded.

So, I tried to make a command that can display the part that needs to be corrected by combining find and some commands as shown below.

find.\(-name\* .pl -or -name\* .pm -or -name\*. cgi \) | xargs grep -e require -e do [^a-zA-Z];

If you execute the above command at the top level of the directory where the Perl script exists, "require" and "do" in the script with the extensions ".pl", ".pm" and ".cgi" will be used. You can extract all the locations where you are.

For example, the following line will be output.

require "mylib.pl";
do "myconf.pl";

If you find such a location, add the following to the beginning of your script: The absolute path of the directory where the script resides is added to the module's include path.

use FindBin;
use lib $FindBin::Bin;

(Reference) FindBin

It's easier to deal with it before the upgrade than to deal with it after upgrading.

Addendum

I've written many times that "." Has been added to the beginning of @INC, but it was a mistake that "." Was added to the end . I got an indication on Twitter.

Related Informatrion