Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I just installed the Net::LDAP module and wrote a short script that uses the module. I can only run the scrip as root. If I run it as a regular user I get the following:
$ ./connect.pl Can't locate Net/LDAP.pm in @INC (@INC contains: /usr/opt/perl5/lib/5. +6.0/aix /usr/opt/perl5/lib/5.6.0 /usr/opt/perl5/lib/site_perl/5.6.0/a +ix /usr/opt/perl5/lib/site_perl/5.6.0 /usr/opt/perl5/lib/site_perl .) + at ./connect.pl line 6. BEGIN failed--compilation aborted at ./connect.pl line 6.
Line 6 is use Net::LDAP. Any help would be appreciated.

Replies are listed 'Best First'.
Re: Installing Net::LDAP module.
by robartes (Priest) on Oct 02, 2002 at 20:56 UTC
    If you do something as root, and then try the same thing as a more mundane user and it doesn't work, then you are almost certainly running into a permission problem. In your case, check whether your user has access rights to the various directories in @INC. To be able to use a module, you need read rights on the directory containing the module and execute rights on every directory in the path leading to it. Of course, this assumes you're on a Unixy OS, but since your superuser is called root, that's probably the case.

    CU
    Robartes-

      Robert, That worked. Thanks. But aren't modules installed with every directory being executable in the first place?

      I used:

      perl Makefile.PL

      make

      make test

      make install

      Thanks.

Re: Installing Net::LDAP module.
by fglock (Vicar) on Oct 02, 2002 at 21:01 UTC

    What robartes said, plus:

    Check that root's @INC is the same as the user's @INC.

    Use   perl -V to see it.

      They are the same. For some reasons, subdirectories created in @INC while installing modules are default executable. Can I change this? It's annoying to have to go chmod every directory manually.
        This is getting slightly un-Perly, but have a look at umask to set default access rights on newly created directories and files. You should find it in your friendly neighbourhood manpages.

        Of course, Perl being what it is, it provides a umask function. Check out the documentation.

        CU
        Robartes-