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

Is there a way install perl modules into a directory of my choosing cg-bin on shared web hosting? I don't have root access, and I not allowed to install modules into the standard Perl directories.
My ISP won't let me install the module in the standard Perl directories, and won't do the installation for me. Can I still install and use my module? How? I can create the directory in my account space(in cgi-bin ?). Where I need specify it? I how to make install??
Need detail instructions..

Replies are listed 'Best First'.
Re: Installing perl modules
by edan (Curate) on Dec 16, 2004 at 15:11 UTC
      To be more specific:
      Server OS: freebsd
      Web Server is Apache/1.3.26 (Unix) mod_perl/1.26
      Base path to website files is /mnt/web_c/d31/s02/a000ras1/cgi-bin/
      Should i create directory in cgi0bin or in any place? Say, directory called 'module' What should i modify in script?
      #!/usr/bin/perl # ---------------------------------------------------------- # program: makehtml.pl # version: 0.06 m5 build 2000-02-15 # task: Creates HTML documents out of a simple script and some # dummy and content files # language: Perl # license: GPL (GNU General Public License) # ----------------------------------------------------------THIS PROGR +AM IS PUBLISHED UNDER THE TERMS OF THE GNU PUBLIC LICENSE (GPL). # IT COMES WITH ABSOLUTLY NO WARRENTY! USE IT AT YOUR OWN RISK! # ---------------------------------------------------------- use GD; use Tie::IxHash; $identify = "makehtml v0.06 m5 build 2000-02-15"; &init; &run; &done; sub init

      Can i also install Text::WikiFormat or full Wiki modules such way?

        The easiest would be to install under cgi-bin (didn't you say that's the only place you can create directories?). But as long as you add use lib '/path/to/some/dir';, it doesn't matter.

        No, you can't install any module this way. The module you asked about happens to be pure-perl, and just one source file. But it's not a general installation procedure by any means.

        Update:

        1. Create the directory /mnt/web_c/d31/s02/a000ras1/cgi-bin/Tie
        2. Copy IxHash.pm there.
        3. Add the line use lib '/mnt/web_c/d31/s02/a000ras1/cgi-bin'; to your program.
        --
        edan

Re: Installing perl modules
by dragonchild (Archbishop) on Dec 16, 2004 at 14:48 UTC
    Use the PREFIX parameter to the "perl Makefile.PL" command. I'm assuming you have commandline access. If you don't, you will only be able to install PurePerl modules, and then only be ftp'ing them to that directory.

    No matter what, you will then have to add a "use lib" statement to all your cgi-bin scripts.

    What module(s) did you want to install?

    Being right, does not endow the right to be rude; politeness costs nothing.
    Being unknowing, is not the same as being stupid.
    Expressing a contrary opinion, whether to the individual or the group, is more often a sign of deeper thought than of cantankerous belligerence.
    Do not mistake your goals as the only goals; your opinion as the only opinion; your confidence as correctness. Saying you know better is not the same as explaining you know better.

      You also can find more information when verifying the perlfac: $panic: perldoc -q module . here is the information you would find:

      How do I keep my own module/library directory?
      When you build modules, use the PREFIX option when generating Makefiles:
      perl Makefile.PL PREFIX=/u/mydir/perl
      then either set the PERL5LIB environment variable before you run scripts that use the modules/libraries
      (see the perlrun manpage) or say use lib '/u/mydir/perl'; This is almost the same as

      BEGIN { unshift(@INC, '/u/mydir/perl'); }

      except that the lib module checks for machine-dependent subdirectories.
      See Perl's the lib man-page for more information.
      I want install Tie::IxHash module.
      And I have *no* any commandline access. It's shared Netfirms webhosting. I have FTP access only.

        In principal, as this is a pure perl module, you could just copy the IxHash.pm file into a lib/Tie directory, say under where your CGI programs are located, and then add the location to your @INC with:

        use lib './lib';
        in your programs. On some platforms you may be forced to give the full path to the 'lib' directory as the notion of '.' might be different for a CGI program.

        /J\

        Then you can probably get away with grabbing the source, changing the package declaration to MyTieIxHash or something, and uploading to MyTieIxHash.pm, and then use tie %hash, 'MyTieIxHash';. YMMV.

        Update: Ah, I didn't see that you can create directories. In that case, create "Tie" directory, put "IxHash.pm" in it, add "use lib '.'" to your script, and you should be good to go.

        --
        edan

Re: Installing perl modules
by Yendor (Pilgrim) on Dec 16, 2004 at 15:07 UTC
Re: Installing perl modules
by sasikumar (Monk) on Dec 17, 2004 at 07:09 UTC
    Hi,
    Is there a way install perl modules into a directory of my choosing cg-bin on shared web hosting? I don't have root access, and I not allowed to install modules into the standard Perl directories.

    set the PERL5LIB environment variable to the path /home/foo.

    Then when u install the module just do this
    perl Makefile.PL PREFIX=/home/foo

    Thanks
    Sasi kumar