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

Hi,

I have a hosting package that give me a shell access. I could write a shell script and excute it on the server remotely.

So my question is how(and the sytanx) could I install perl module remotely using what my hosting provider is giving me?

TQ

Replies are listed 'Best First'.
Re: Instal perl module remotely
by Zaxo (Archbishop) on May 08, 2006 at 04:39 UTC

    You'll need to set up a directory under your home tree to install the modules in. ~/lib/perl5 is canonical and convenient.

    Then you can either upload the module tarballs and do the

    $ tar -xzf Foo.tar.gz $ cd Foo $ perl Makefile.PL PREFIX=${HOME} $ make $ make test $ make install
    dance, or you can follow Re: Creating my own CPAN directory to produce a private non-root CPAN setup for your home directory. I recommend the second for convenience.

    In either case you need to tell perl to search your private lib for modules. Setting the PERL5LIB environment variable will do that for you.

    Update: Oops, thanks, bart++. Repaired. I knew there was something fishy about that!

    After Compline,
    Zaxo

      perl Configure.PL PREFIX=${HOME}
      "Configure.PL"?? What kind of distribution is that? Are you sure this isn't supposed to be Makefile.PL instead?
      I've been using Module::Build for some CPAN modules recently and I've have had to do non-root installs. Here's the Build.PL equivalent to Zaxo's post about using Makefile.PL.
      $ tar -xzf Foo.tar.gz $ cd Foo $ perl Build.PL $ ./Build install_base=${HOME} $ ./Build test $ ./Build install

      Dangit! Only last week, I decided I had to use CGI::Session over Apache::Session because my webhost's server didn't have Apache::Session installed. It was an easy decision - a no-brainer in fact, because I thought I had no other (easy) option. And now you go and tell me how to install Apache::Session myself! Now I'm going to have to do some research to find out what's best. What a nuisance! ;-)

      But seriously, thanks Zaxo.

      Polonius
Re: Instal perl module remotely
by moklevat (Priest) on May 08, 2006 at 04:31 UTC
    Because you have shell access you should look at Zaxo's excellent node on non-root use of CPAN.

    Update: Alternatively you could look at Zaxo's excellent node below... :-)

Re: Instal perl module remotely
by tweetiepooh (Hermit) on May 08, 2006 at 10:39 UTC
    Does the host also have the tools you need to build the module? Compilers etc.

    You may need to build locally and then send the built stuff up. Maybe create the library in home/programme directory and then tar it up, transfer the whole bundle to the host and unpack it.

    Other posts give pointer to building modules not in the perl directories.

    Also with non-Perl modules you may need to ensure that any dependant libs are also present.