Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

How to provide an isolated Perl environment for newly added users?

by walkingthecow (Friar)
on Nov 28, 2013 at 09:22 UTC ( #1064776=perlquestion: print w/ replies, xml ) Need Help??
walkingthecow has asked for the wisdom of the Perl Monks concerning the following question:

My thought here was to utilize /etc/skel. As root, I installed Perlbrew and then preceded to build a few versions of Perl. I copied the perl5/ folder to /etc/skel and then added a user. I logged in as the new user, wrote a simple script and tried to run it, but I get this error: "Can't locate strict.pm: Permission denied at /tmp/test.pl line 2." Ah, silly me, I compiled as root and so @INC now contains paths such as '/root/perl5/perlbrew/perls..." (you get the idea).

So, now I am stuck wondering how exactly I would accomplish this. Any ideas?

Comment on How to provide an isolated Perl environment for newly added users?
Re: How to provide an isolated Perl environment for newly added users?
by daxim (Chaplain) on Nov 28, 2013 at 10:19 UTC
Re: How to provide an isolated Perl environment for newly added users?
by Tommy (Chaplain) on Nov 28, 2013 at 14:32 UTC

    I have run into the exact same problem on the script server I set up for my alliance on Lacuna Expanse.

    I've found that editing the metadata files for the perlbrew installation in the new user's home directory (and the new user's .bashrc/.bash_profile) is the way to correct the path problem. It really was quite simple, even though it wasn't automated.

    For an automated solution, a quick search/replace script could be created to do the path corrections for you in the appropriate files.

    One final point of advice: Look in the ~/.cpanm / ~/.perlbrew/ directories for any conf files that need updating as well. As the new user, run the cpanm command on a simple module to make sure you got it right.

    Good luck!

    Tommy
    A mistake can be valuable or costly, depending on how faithfully you pursue correction
Re: How to provide an isolated Perl environment for newly added users?
by aitap (Deacon) on Nov 30, 2013 at 21:19 UTC
    perlrun contains a list of useful environment variables, including PERL5LIB which is added to @INC splitted by ":". Have a look at how does local::lib modify Perl's, ExtUtil::MakeMaker's and Module::Build's behaviour to install modules to and run modules from the user's home directory.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (9)
As of 2014-09-22 17:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (198 votes), past polls