Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: yast vs cpan

by jbert (Priest)
on Nov 09, 2006 at 18:54 UTC ( [id://583191]=note: print w/replies, xml ) Need Help??


in reply to yast vs cpan

The way I handle this is to use the system packaging tools (yast in your case, apt in mine) to install the distro's packages if possible.

If the module I need either isn't packaged by the distro, or if I want a newer version, I install via cpan, but as my own non-privileged userid.

When you run CPAN as yourself, the questions tell you how to provide additional args to 'perl Makefile.PL' (PREFIX=foo) or 'Build.PL' (--install_base foo) to install in your home directory. I tend to put things in $HOME/install/perl.

Then you tell your shell to tell perl (when run as you) to find these modules:

export PERL5LIB = $PERL5LIB:$HOME/install/perl/share/perl export PERL5LIB = $PERL5LIB:$HOME/install/perl/lib/perl
and you can then have the best of both worlds. This won't allow other users (e.g. whatever userid your web server runs as) on your box to run the modules, but you can fix that by setting PERL5LIB to refer to your homedir install in that environment too (and check the file permissions work out).

This also works nicely in the multiple-machine one-NFS-homedir setup.

Replies are listed 'Best First'.
Re^2: yast vs cpan
by elnino2007 (Novice) on Nov 09, 2006 at 19:19 UTC
    wow, you guys are fast. jbert, these are for the webserver, so, in that case what would you do?
      Hmmm....probably as described. Using the distro packages as far as possible helps keep you up to date on security fixes etc (as long as you are running your update commands).

      If you *do* need something not packaged by your distro, set up a localised install tree as described above. I'd probably create a user 'cpan' to own it and install the modules to its homedir. If I was very paranoid, I'd actually install to /home/cpan/install/perl, check everything worked and then copy (rsync) the ~/install/perl to wherever I had configured the web server to pick them up from (somewhere not under your document root, obviously).

      Note: you generally don't set environment variables for CGIs etc in .bash_profile for your web server user, but how you do it is web-server specific. The apache docs cover setting env vars pretty well.

      Have fun and good luck.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://583191]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (5)
As of 2024-04-19 22:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found