in reply to Re: perl lost its modules!
in thread perl lost its modules!

I agree that it's really frustrating when upgrading your Perl breaks stuff.

In this case, the error message that Perl spits out when it cannot compile for this reason (missing permissions on a directory in @INC) should include a warning about the fact that it has stopped searching @INC. It does emit a message (with brevity, and still without specifically saying that the directory permissions were missing, and stating the full path of the file even if it doesn't know whether the file exists), starting in Perl 5.21.7:

$ perl5217 -I/root -Mstrict -e 1 Can't locate strict.pm: /root/strict.pm: Permission denied. BEGIN failed--compilation aborted.
There is a currently open bug discussing this, with the reporter calling for the change to be rolled back. You can also read the bug issue report that prompted the change in the first place.

Note that the directory must be executable, and the file readable. Having the directory readable if it's not executable doesn't help, on my machine at least. Using Perl 5.22:

[14:14][nick:~]$ sudo ls -la /var/noperms total 0 dr--r--r-- 3 root wheel 102 Sep 7 14:06 . drwxr-xr-x 28 root wheel 952 Sep 7 13:38 .. -r--r--r-- 1 root wheel 0 Sep 7 14:06 strict.pm [14:14][nick:~]$ perl -I/var/noperms/ -Mstrict -e 1 Can't locate strict.pm: /var/noperms/strict.pm: Permission denied. BEGIN failed--compilation aborted.
. . . the directory doesn't have to be readable at all, as long as it's executable:
[14:17][nick:~]$ sudo ls -la /var/noperms total 0 d--x--x--x 3 root wheel 102 Sep 7 14:06 . drwxr-xr-x 28 root wheel 952 Sep 7 13:38 .. -r--r--r-- 1 root wheel 0 Sep 7 14:06 strict.pm [14:17][nick:~]$ perl -I/var/noperms/ -Mstrict -e 1 strict.pm did not return a true value. BEGIN failed--compilation aborted.
And it definitely prints the full path of the file it's looking for, even if it can't read the directory, making for a very confusing error message:
[14:19][nick:~]$ sudo ls -la /var/noperms total 0 d--------- 2 root wheel 68 Sep 7 14:19 . drwxr-xr-x 28 root wheel 952 Sep 7 13:38 .. [14:19][nick:~]$ perl -I/var/noperms/ -Mstrict -e 1 Can't locate strict.pm: /var/noperms/strict.pm: Permission denied. BEGIN failed--compilation aborted.

The way forward always starts with a minimal test.

Replies are listed 'Best First'.
Re^3: perl lost its modules!
by Anonymous Monk on Sep 07, 2015 at 22:58 UTC

      The error message is better but still awful, in my opinion. As is the fatal error to begin with.

      The way forward always starts with a minimal test.