http://qs321.pair.com?node_id=422450

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

I am currently using hosting that dosen't have the module I want(Date::Calc). Can I create a folder in my cgi-bin and then upload all in my 'date' folder from hard drive. Can my system then detect the module?

Replies are listed 'Best First'.
Re: Perl module
by Thilosophy (Curate) on Jan 15, 2005 at 04:14 UTC
    Yes, if the module is pure Perl (as opposed to modules that contain C code) you can just copy it to a folder on your web server.

    As for finding the module, if you put it in your cgi-bin directory, the CGI script should find it automatically. (If the module is Foo::Bar, make put it to cgi-bin/Foo/Bar.pm ). If you want to put it somewhere else, use lib '/some/path'.

    Now the bad news: Date::Calc contains C code and needs to be compiled on the host machine. That needs shell access. You can still install it in your cgi-bin (or anywhere else), so you do not need root access, but you need shell access to compile it.

    Recommended reading: A Guide to Installing Modules here on PerlMonks

    Update: Actually, as sgifford pointed out below, (please vote him up !) you do not really need shell access: You can wrap the install script in a CGI script and run it through the web server.

      I install things without shell access all the time. It goes something like this:
      $ wget module-src.tar.gz $ cat >install-module #!/bin/sh -x printf "Content-type: text/plain\n\n" tar xvzf module-src.tar.gz cd module-src perl Makefile.PL PREFIX=/your/home make make test make install ^D $ ftp your.hosting.site ftp> cd cgi-bin ftp> bin ftp> put module-src.tar.gz ftp> put install-module ftp> site chmod +x install-module ftp> quit

      Then visit http://your.site/cgi-bin/install-module. Of course this will all vary somewhat, but the basic formula works.

      Update: As CountZero says, your provider must have the appropriate compiler available. And don't forget to remove the install-module script when you're done, for security reasons.

      Provided of course your web-host has a C-compiler installed and available to be run by whatever privileges the cgi-process runs under.

      CountZero

      "If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law

Re: Perl module
by arcnon (Monk) on Jan 15, 2005 at 15:27 UTC
    date::calc has xs code... You might ask your provider to install the module if installing in your directory does work. also if you have to pay for disk space on your server you can get carried pretty easily and waste all your space on modules: )
      Good call. Sending a quick email to your provider asking to have a module installed is the smart way to go. If that is beyond their technical means, or their courtesy to you as a customer then perhaps you should find a different provider.
        And if you do need a different provider, I highly recommend FutureQuest. They are about as open-source- and Perl-friendly as you could hope for. Their hosting rates are low, their tech support is superb, and they are always open to any reasonable request to install a module. I've used them for several years now and have zero complaints about their service.
Re: Perl module
by rinceWind (Monsignor) on Jan 15, 2005 at 12:40 UTC
    You might also want to consider PAR. This provides a means of packaging up your script with all modules called into an exe.

    --
    I'm Not Just Another Perl Hacker

Re: Copy perl module to webhost
by tinita (Parson) on Jan 18, 2005 at 09:36 UTC