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

Hi Monks, I have a issue wherein my perl modules installed are not working for non-root users. for e.g. If I am logged in as root "perldoc Term::Size" works If I am logged in as non-root "perldoc Term::Size" shows perl module not installed. The same perl is being used for both root and non-root users. I am not sure as why this is happening. Please suggest. Thanx in advance
  • Comment on perl module not getting listed for non root user

Replies are listed 'Best First'.
Re: perl module not getting listed for non root user
by chromatic (Archbishop) on Aug 12, 2008 at 04:50 UTC

    perl -e 'print join "\n", @INC' should be different for root and non-root.

      Hi, Thnx for the reply I can see that the contents of @INC are same for non-root and root user.
      $ perl -e 'print join "\n", @INC'
      /usr/opt/perl5/lib/5.8.2/aix-thread-multi
      /usr/opt/perl5/lib/5.8.2
      /usr/opt/perl5/lib/site_perl/5.8.2/aix-thread-multi
      /usr/opt/perl5/lib/site_perl/5.8.2
      /usr/opt/perl5/lib/site_perl
      .$ su -
      root's Password:
      sdp2:/> perl -e 'print join "\n", @INC'
      /usr/local/jboss/lib/perl
      /usr/opt/perl5/lib/5.8.2/aix-thread-multi
      /usr/opt/perl5/lib/5.8.2
      /usr/opt/perl5/lib/site_perl/5.8.2/aix-thread-multi
      /usr/opt/perl5/lib/site_perl/5.8.2
      /usr/opt/perl5/lib/site_perl
      Is it possible that non-root user is not ale to search under /usr/?
        You are blind :)
        perl -le' print for @INC' >nonroot-inc perl -le' print for @INC' >root-inc diff -ub nonroot-inc root-inc
Re: perl module not getting listed for non root user
by Corion (Patriarch) on Aug 12, 2008 at 06:08 UTC

    Maybe your other user does not have the read/execute/whatever permissions to one of the directories below which Term::Size lives. Check using truss or strace to see, if ls doesn't turn up anything.

Re: perl module not getting listed for non root user
by tilly (Archbishop) on Aug 12, 2008 at 13:42 UTC
    Tip. perldoc -l Term::Size as root will tell you where that module is. If you want them somewhere else (like wherever Joe random user picks up modules), you can usually (not always, but usually) just copy the directory tree. perldoc -l CPAN::Config will tell you where the CPAN configuration file is. Editing the latter can change what directory is chosen on future module installs.
Re: perl module not getting listed for non root user
by eosbuddy (Scribe) on Aug 12, 2008 at 04:59 UTC
    You may need to set path for each user (or add it into the, if runnling *nix, .login or the equivalent file). More details here Have fun :-)
      Thanx for the reply.
      The link suggested by you mentions about using the perl modules installed in my home directory.
      My issue is that I have the perl modules installed by the root under /usr/opt. I want to use these perl modules only.
        One way is to have all your programs access the modules via pragmas of the following type:
        #!/usr/bin/perl use lib "/usr/opt/<path-to-perlmodule-folder>";
        The other way is to specify the path in each user's .bashrc or .login which is called when you login like this (you can also make an entry in /etc/bash.bashrc or /etc/login.defs or equivalent files so that new users you add automatically get it into their login rc files).
        export PERL5LIB=/usr/opt/<path-to-perl5-module-folder>