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

installing local modules

by emilford (Friar)
on Jun 27, 2002 at 17:14 UTC ( #177773=perlquestion: print w/replies, xml ) Need Help??

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


I've grown tired of waiting around for my hosting server's tech support to respond to my requests, as they've become a bit slow and unreliable. It seems that a large number of needed Perl modules are not currently installed by host. I'm wondering if someone could give me a little guidance on installing Perl modules locally, so I no longer have to rely on tech support.

I need questions answered like:
  • What steps do I take to install the module?
  • Will I run into permission problems?
  • Is there a chance of screwing things up big time?
  • Will the modules be installed to the right place automatically?
  • Will the Perl scripts instantly be able to find the newly installed modules or is this a seperate step?
I'd appreciate any help anyone can offer. On a side note, can anyone recommend a good, cheap, reliable (and so on) host for a simple, personal website?

TIA, emilford

Replies are listed 'Best First'.
Re: installing local modules
by BazB (Priest) on Jun 27, 2002 at 17:44 UTC

    Just to add to what dimmesdale has said...
    If you want to install a module somewhere other than the default location, use

    perl PREFIX=/where/to/install/

    in place of


    Update: You might also find tachyon's tutorial helpful.

      I've found that PREFIX alone is sometimes not enough. HTML::Mason, for example, would not install for me without all the added info. Here's the setup I use when I run perl Makefile.PL:

      PREFIX=/home/tgi/usr/local \ INSTALLPRIVLIB=/home/tgi/usr/local/lib/perl5 \ INSTALLSCRIPT=/home/tgi/usr/local/bin \ INSTALLSITELIB=/home/tgi/usr/local/lib/perl5/site_perl \ INSTALLBIN=/usr/home/tgi/usr/local/bin \ INSTALLMAN1DIR=/home/tgi/usr/local/lib/perl5/man \ INSTALLMAN3DIR=/home/tgi/usr/local/lib/perl5/man/man3

      I have this saved in a file called popt (for perl options) and I just issue the command perl Makefile.PL `cat ~/popt`. I like to recreate the /usr hierarchy of a traditional perl installation, but that is not necessary.

      To add modules to your search path you have a couple of options. You may be able to modify the enviroment on your server through an .htaccess file (if you are on an apache based system). On a mod_perl enabled server, you can use PerlSetEnv PERL5LIB /path/to/private/libraries/. Otherwise you are likely to be stuck adding a use lib qw(/path/to/modules /ya/path/to/modules); to each script.

      TGI says moo

        I do something similar in scripts that automate module installation. However, I use a longer list of variables:
        $makefile_args =
          " INSTALLPRIVLIB=$prefix/usr/lib/perl5/5.6.0 " .
          " INSTALLARCHLIB=$prefix/usr/lib/perl5/5.6.0/i386-linux " .
          " INSTALLSITELIB=$prefix/usr/lib/perl5/site_perl/5.6.0 " .
          " INSTALLSITEARCH=$prefix/usr/lib/perl5/site_perl/5.6.0/i386-linux " .
          " INSTALLBIN=$prefix/usr/bin " .
          " INSTALLSCRIPT=$prefix/usr/bin " .
          " INSTALLMAN1DIR=$prefix/usr/share/man/man1 " .
          " INSTALLMAN3DIR=$prefix/usr/share/man/man3 ";
        All I do is set the $prefix. Voila! Modules where we want 'em!
Re: installing local modules
by janx (Monk) on Jun 27, 2002 at 17:49 UTC
    There are a couple of considerations:
    • What type of access do you have on that host system?
      If you have ssh or telnet access your life has become easier.
    • If you have access to a c compiler and a make utility on that system you're fine, too.

    If you are on a UN*X-like system you can do:
    perl Makefile.PL PREFIX=~/private_modules make make test make install
    This will install the module in question into the private_modules directory in your home directory.
    Note that this is not guaranteed to work with all modules. See ExtUtils::MakeMaker for details.

    In general you can safely install your private modules into your own directory and let perl look for packages in there first by doing:

    use lib "~/my_private_modules_first"; print join ":", @INC;
    Perl has the list of directories to search stored in its @INC array, so you might want to play with that.
    Of course check out also ;-).

    If you do not have direct access to the server, things get a bit more difficult, as you will have to prepare the modules by yourself on your local system first, and then upload them to the right directory on your server.


      Instead of a use lib statement, you might also consider setting the PERL5LIB environment variable.

Re: installing local modules
by dimmesdale (Friar) on Jun 27, 2002 at 17:21 UTC
    (1) Download module from cpan, untar and here you go:
    nmake test
    nmake install

    Not that I've ever encountered.

    YES (well, if you delete all the important files on the computer while waiting for the download, otherwise you're pretty much safe)

    When I've installed modules they went right to the directory where Perl is kept and into its lib folder. (Of course, you can always find where they go and add it to the @inc array using use lib if need be).

    There're many. I've used netfirms myself and liked it. It all depends on your needs (e.g., cgi support, php, willing to accept company's banners). I have a good site at another computer (the URL is saved, I mean) and when I get there, I'll update this if no one else has given more help in this area.

Re: installing local modules
by little (Curate) on Jun 27, 2002 at 17:45 UTC

    Modules that get along with use lib might be an interesting read. If something remains unclear, eg. usage of 'use lib /path/to/;' try searching for 'use lib' :-)

    Have a nice day
    All decision is left to your taste
Re: installing local modules
by cidaris (Friar) on Jun 27, 2002 at 18:26 UTC
    To answer your side note:
    pair Networks (who happen to advertise on this site) in my experience have been excellent. If you're a coder, you've got the freedom to do basically whatever you want, access to MySQl all that. If you're a non-programmer, or would rather not mess with it, they have forms for creating your mail recipes, cronning scripts, etc.

    They've always been quick to respond to questions, their rates are reasonable, and they offer decent discounts for bulk purchases.

    They also e-mail you if you forget to pay your bill, which has turned out pretty handy ;)

    I've hosted 2 sites I've developed with them thus far, and have only had pleasant experiences.


      I have to agree with cidaris on this one. I maintain an online store for a client, and I think that pair support is amoung the best I have ever worked with. In addition, all of thier systems are very well set up and maintained.

      Their downside is that they are a tad on the expensive side. In my eyes though, they are probably worth the money.

Re: installing local modules
by George_Sherston (Vicar) on Jun 27, 2002 at 21:46 UTC
    On your last point, uklinux gives you pretty much everything you need for free - I've always found them reliable, and as the name suggests they're on the side of the angels.

    George Sherston
Re: installing local modules
by Popcorn Dave (Abbot) on Jun 28, 2002 at 03:42 UTC
    As far as your side note, I can also give high praise for Hurricane Electric.

    I've hosted three different accounts with them and always found them to be very helpful. Plus you can get away for $10 a month with 25M of storage.

    In addition I've called up at 2am on a Saturday and the tech ( who was apparently bored ) managed to help me get a script running that wasn't. ;)

    Some people fall from grace. I prefer a running start...

Re: installing local modules
by Anonymous Monk on Jun 28, 2002 at 14:44 UTC
    Normally for unix, sh configure -PREFIX=lib where lib is your local lib folder will work. Try that with use lib and see if it works right away (read the README and INSTALL documents). Berkeley make or else nmake on windows.

    But things have gone badly in the past, and so I sometimes have ended up making a folder for the module namespace called by the same name next to the script. So DBD::Mysql would become folder DBD, and or whatever binary files you get after compiling would get unceremoniously dumped in that folder. Then adding -IDBD to the shebang line in your script often works.

    This breaks if the server OS gets updated, which has happened to me in the past.

      sorry that was me unlogged in.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://177773]
Approved by little
Front-paged by grinder
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (4)
As of 2023-12-10 12:49 GMT
Find Nodes?
    Voting Booth?
    What's your preferred 'use VERSION' for new CPAN modules in 2023?

    Results (40 votes). Check out past polls.