Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

A good summary of how to use Perl in shared-hosting environments

by sundialsvc4 (Abbot)
on Feb 20, 2008 at 17:25 UTC ( [id://669055]=perlmeditation: print w/replies, xml ) Need Help??

Lots of us use Perl in shared-hosting environments where very brain-dead ancient Perl-versions are the only thing that we have readily available, and of course we aren't root and can't change anything at all about the global implementation.

Here, snipped from the documentation on SOAP::Lite, is a good summary of “how to do it,” which I thought I'd share for posterity.

 

WEBHOSTING INSTALLATION

As soon as you have telnet access to the box and XML::Parser is already installed there (or you have Perl 5.6 and can use XML::Parser::Lite) you may install your own copy of SOAP::Lite even if hosting provider doesn't want to do it.

Setup the PERL5LIB environment variable. Depending on your shell it may look like:

PERL5LIB=/you/home/directory/lib; export PERL5LIB

lib here is the name of directory where all libraries will be installed under your home directory.

Run CPAN module with:

perl -MCPAN -e shell
and run three commands from CPAN shell:
> o conf make_arg -I~/lib
> o conf make_install_arg -I~/lib
> o conf makepl_arg LIB=~/lib PREFIX=~ INSTALLMAN1DIR=~/man/man1 INSTALLMAN3DIR=~/man/man3

LIB will specify directory where all libraries will reside.

PREFIX will specify prefix for all directories (like lib, bin, man, though it doesn't work in all cases for some reason).

INSTALLMAN1DIR and INSTALLMAN3DIR specify directories for manuals. If you don't specify them, install will fail because it'll try to setup it in default directory and you don't have permissions for that.

Then run:

> install SOAP::Lite

Now in your scripts you need to specify:

use lib '/your/home/directory/lib';
somewhere before 'use SOAP::Lite;'

And now, just a few additional closing comments from me ...

When you set up your web-site, you can specify a value for PERL5LIB using an Apache directive such as SetEnv. You can also, more-securely, opt to use a “honkin' big use lib statement” directly in your Perl module(s), thereby hard-coding the library search-path and ensuring that your locally-defined modules will be seen at the exclusion of all others.

Also not-expressly-mentioned in this description is the fact that, when you log-in to the host, say through an ssh session, you will need a script that you can run to set-up the environment variables that you need. It may be like the set/export sequence shown above or it may be more complicated, but you definitely need to write a little script-file to do it. (I also discovered that on my host I could not use .bash_login for this purpose... and that doing so actually interfered with ssh! I have to remember to run this shell-command file upon login, before using cpan, to set up the environment for this logon-session to match the one that will be seen by the Perl handlers of the web-site.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlmeditation [id://669055]
Approved by Arunbear
Front-paged by zby
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (5)
As of 2024-04-25 10:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found