Symptoms
When running a Perl script under Perl version 5.26.x, you encounter an error similar to the following.
Can't locate $module.pm in @INC (you may need to install the $module module) (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5) at /home/$username/public_html/cgi-bin/$script.pl line 2.
Description
In Perl version 5.26, the current directory (.
) was removed from @INC
due to security concerns.
Workaround
Add the following to your Perl script.
BEGIN { my $dir = "/some/trusted/directory"; chdir $dir or die "Can't chdir to $dir: $!\n"; push @INC, '.'; }
Please note that "/some/trusted/directory" must be replaced with the full path to the where directory the script will be run.
Additional resources
Perl 5.26.0 Release Notes: Removal of the current directory (".") from @INC
Comments
0 comments
Article is closed for comments.