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

Greetings oh wise ones. I am a newbie who has been banging his skull for 2 weeks with no satisfaction.
I am looking to run the CGI:Session module on a Web site hosted by ISP, Register.com. They don't provide telnet or
any other tools to execute a file on the site so I cannot run PPM or CPAN to open and install the module.
I am proposing to extract the files to my Windows PC (done from Active State) and then FTP them to the cgi-bin
folder of my hosted Web site. Somewhere I read that I can do that if I copy the directories and the *.pm files:

cgi-bin/lib/CGI
session.pm
cgi-bin/lib/CGI/Session
Fast.pm, Switch.pm, Apache.pm, Carp.pm, Push.pm, Cookie.pm, Session.pm
cgi-bin/lib/CGI/Session/ID
incr.pm, md5.pm, static.pm
cgi-bin/lib/CGI/Session/Driver
a bunch of *.pm files
cgi-bin/lib/CGI/Session/Serialize
a bunch of *.pm files

etc..... everything is permission 755

But my script is not working! Can this installation method work? Or is there a problem with my script:

#!/usr/bin/perl -w use strict; use CGI; use lib '~/cgi-bin/lib/CGI/'; use CGI::Carp qw(fatalsToBrowser); use CGI::Session; my $cgi = new CGI; my $session = new CGI::Session(undef, $cgi, {Directory=>'/tmp'});

Browser Error message:
Software error: Can't locate CGI/Session.pm in @INC (@INC contains:
/usr/local/lib/perl5/5.6.1/i686-linux
/usr/local/lib/perl5/5.6.1
/usr/local/lib/perl5/site_perl/5.6.1/i686-linux
/usr/local/lib/perl5/site_perl/5.6.1
/usr/local/lib/perl5/site_perl .) at /services/webpages/d/o/domaine.com/cgi-bin/login1.pl line 5. BEGIN failed--compilation aborted at /services/webpages/d/o/domaine.com.com/cgi-bin/login1.pl line 5.

Note: domaine.com is my substutite

I am told their servers run Apache /Unix (should be on or the other, right?

Replies are listed 'Best First'.
Re: Unable to install CGI::Session on a hosted site
by ikegami (Patriarch) on Oct 06, 2007 at 04:02 UTC

    That should be

    use lib '~/cgi-bin/lib';

    cause use CGI::Session searches for CGI/Session.pm.

      Another problem is the '~' in the path. In contrast to most shells, Perl will not expand ~ to your home directory (and there's no shell involved here).  Treating it literally typically isn't what you want...

Re: Unable to install CGI::Session on a hosted site
by Anonymous Monk on Oct 06, 2007 at 06:51 UTC
    @INC not contains paths with cgi-bin
      I removed the CGI::Session module folder from my cgi-bin directory, following your suggestions, and placed it in /public/perlmod/CGI with 755 (The public folder hangs from the root)

      However, I still get "Can't locate CGI/Session.pm in @INC (@INC contains: /public/perlmod/CGI.....

      I noticed in the boilerplate my ISP uses when loading SSH that (Quote)Your homedirectory begins at "/". Yet, "/etc" is a system directory. This can be a bit confusing at first. Your public directory is found at: /public and so on. If you are working with scripts using absolute, hard-coded paths and need to run them in the shell, consider using the environment variable "DOCUMENT_ROOT" in your code.
      This is always set properly and will work in the shell and when run through the webservers.(unquote)

      This explains why I placed /perlmod under /public. I am clueless when it comes to applying DOCUMENT_ROOT.

      If it helps at all the full path of my Web site on the server is: /services/webpages/m/y/mydomaine.com

      Thanks again