-1

I installed CGI::Session module on my host by creating the perl-modules directory in my cgi-bin and then extracting the module to that directory so I have:

D: cgi-bin/perl-modules/CGI/
F: cgi-bin/perl-modules/CGI/Session.pm
D: cgi-bin/perl-modules/CGI/Session/
F: cgi-bin/perl-modules/CGI/Session/File.pm
D: cgi-bin/perl-modules/CGI/Session/ID/
D: cgi-bin/perl-modules/CGI/Session/Searialize/

In a script I do (this is located in cgi-bin/test/):

     use lib '../perl-modules';
     use CGI::Session;
     $session = new CGI::Session (
                "driver:File", 
                undef,
                {Directory => '/tmp'}
            );

$session->param('_logged_in', 1);
$session->param('_remote_ua', $ENV{'HTTP_USER_AGENT'});
$session->expire('+2hr');

Everything works fine untill the call to expire. When I put the expire call inside an eval I get the following error:

Can't locate auto/CGI/Session/File/expire.al in @INC (@INC contains: ../perl-modules /usr/lib/perl5/5.8.7/i686-linux /usr/lib/perl5/5.8.7 /usr/lib/perl5/site_perl/5.8.7/i686-linux /usr/lib/perl5/site_perl/5.8.7 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.7/i686-linux /usr/lib/perl5/vendor_perl/5.8.7 /usr/lib/perl5/vendor_perl .)

Any ideas?

brian d foy
  • 129,424
  • 31
  • 207
  • 592
user105033
  • 18,800
  • 19
  • 58
  • 69
  • 2
    Don't install modules by unzipping them. Sometimes they need to do something to set up the files to install. Use the INSTALL_BASE or --install_base arguments to tell the distro where to put the files. – brian d foy Feb 10 '10 at 02:37

2 Answers2

1

Latest CGI::Session distribution archive does not have CGI::Session::File - you must be using very old version. In new version, you need to write "driver:file" in new call (note case of 'f').

If you need that outdated version and can't install anything on hosting, install that version of CGI::Session locally, and copy "auto/CGI/Session/" directory from %Perl%/site/lib/ to hosting too. Another option is to do make without cpan shell and copy that dir from blib/arch.

Alexandr Ciornii
  • 7,346
  • 1
  • 25
  • 29
1

I think your problem lies in relative pathing. It seems safe to assume that your script is being executed from Apache or another web server. In that case, ../perl-modules/ could be just about anywhere.

On my web server, the current working directory is /usr/local/apache22/, so ../perl-modules/ would resolve to /usr/local/apache22/../perl-modules, or /usr/local/perl-modules/. In order to overcome this, I'd suggest putting an absolute path in instead of a relative path. For example:

use lib '/home/user105033/perl-modules/';
Jack M.
  • 30,350
  • 7
  • 55
  • 67