Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re^2: perl lost its modules!

by 1nickt (Abbot)
on Sep 07, 2015 at 18:50 UTC ( #1141276=note: print w/replies, xml ) Need Help??


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.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1141276]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (5)
As of 2019-09-20 18:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    The room is dark, and your next move is ...












    Results (268 votes). Check out past polls.

    Notices?