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

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/HiRes.pm 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 :
/home/userx/perl5/perlbrew/perls/perl-5.17.8/lib/5.17.8/x86_64-linux/Time
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..
thanks

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

Comment on shared perlbrew running as root
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.

    /G

      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?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1016598]
Approved by marto
Front-paged by Lotus1
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (11)
As of 2014-08-22 07:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (148 votes), past polls