Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

shared perlbrew running as root

by rootcho (Pilgrim)
on Feb 01, 2013 at 18:39 UTC ( #1016598=perlquestion: print w/replies, xml ) Need Help??
rootcho has asked for the wisdom of the Perl Monks concerning the following question:

I have perlbrew installed in one of my user accounts and what to be able to use it from root.
I configured root ./.bashrc to have :
export PERLBREW_ROOT=/home/userx/perl5/perlbrew
source $PERLBREW_ROOT/etc/bashrc
also :
root# perlbrew list
* perl-5.17.8
So far so good I can run perl scripts from bash-console as root
The problem is if I try to run perl script inside a bash script, I get complains about modules not found :
Can't locate Time/ in @INC (@INC contains: /home/userx/perl5/perlbrew/perls/perl-5.17.8/bin/../lib /usr/local/lib64/perl5 ...
And yes if I try to do :
root# perldoc Time::HiRes
Can't find any loadable formatter class in Pod::Perldoc::Toman Pod::Perldoc::Toman ...
But if I check in my userx account I can see the package here :
And of course doing perldoc Time::HiRes from usex account works.
userx$ cpanm Time::HiRes
Time::HiRes is up to date. (1.9725)
What could be the problem... it seems like PERLLIB problem ? and how to solve it..

PS> And of course I have this in the bash script :
export PERLBREW_ROOT=/home/userx/perl5/perlbrew
export PERLBREW_HOME=~/.perlbrew
source ${PERLBREW_ROOT}/etc/bashrc

Replies are listed 'Best First'.
Re: shared perlbrew running as root
by chexmix (Hermit) on Feb 01, 2013 at 21:23 UTC
    Try running

    env | grep PERL5LIB

    both as userx and as root. I admit up front I don't know anything about perlbrew, but I agree it does sound like a library issue. If you get a certain value for PERL5LIB as userx and nothing as root, I'd try setting PERL5LIB for root to whatever it is you got as userx.

    Or alternately, use a 'use lib' statement in scripts owned by root.


      In both cases there is no PERL5LIB
Re: shared perlbrew running as root (perlbrew switch)
by Anonymous Monk on Feb 01, 2013 at 23:05 UTC
    What does perlbrew switch say?
      # perlbrew switch
      Currently switched to perl-5.17.8

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1016598]
Approved by marto
Front-paged by Lotus1
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (14)
As of 2017-01-17 14:32 GMT
Find Nodes?
    Voting Booth?
    Do you watch meteor showers?

    Results (156 votes). Check out past polls.