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

I wrote a very simple redirect html cgi form and tested it to verify it worked, then I called the page from a browser. The error log says it could not find CGI::Session in the designated paths. and yet it is in the path. How can I fix this path issue? error message says it can't find it, but its in the path, tiny script works on the command line.

[Thu Feb 06 00:09:56 2014] [error] [client 153.64.146.203] Can't locat +e CGI/Session/ErrorHandler.pm in @INC (@INC contains: /usr/lib/perl5/ +5.10.0/x86_64-linux-thread-multi /usr/lib/perl5/5.10.0 /usr/lib/perl5 +/site_perl/5.10.0/x86_64-linux-thread-multi /usr/lib/perl5/site_perl/ +5.10.0 /usr/lib/perl5/vendor_perl/5.10.0/x86_64-linux-thread-multi /u +sr/lib/perl5/vendor_perl/5.10.0 /usr/lib/perl5/vendor_perl .) at /usr +/lib/perl5/5.10.0/CGI/Session.pm line 4. audrey:/usr/lib/perl5/5.10.0/CGI # find /usr/lib/perl5 -name Session.p +m /usr/lib/perl5/site_perl/5.10.0/CGI/Session.pm
#!/usr/bin/perl -w use strict; use CGI::Session; #use lib "/usr/lib/perl5/site_perl/5.10.0/"; # no cookie no worky my $session = CGI::Session->load(); redirect() if ($session->is_empty); 1; sub redirect { print q(Content-type: text/html <html> <head> <title>Redirect to logon </title> </head> <body> <META HTTP-EQUIV="refresh" CONTENT="10;URL=https://audrey/logon.html"> Logon Expired or not valid... Redirecting </body> </html> );

############Found MY Own Fix############ Oh buggy day one security issue, if I try to run perl as web user AND I need to access one of these libraries then I will get a premature end of file error. What I found was the perl5 library directories are created as drwxr-x--- This blocks the “other” user. A simple workaround is to change the directory permissions for the particular part of the library that needs to be used. OR, add the web user to the group root, (NOT!) Script to find the offending directories: find /usr/lib/perl5 -type d ! -perm /o=r -print

Replies are listed 'Best First'.
Re: CGI:Session found but not ( CGI/Session/ErrorHandler.pm )
by Anonymous Monk on Feb 06, 2014 at 08:46 UTC

    The message says Can't locate CGI/Session/ErrorHandler.pm in @INC

    CGI::Session is CGI/Session.pm but it isn't CGI::Session::ErrorHandler

    You need to reinstall CGI::Session so all the things that are part of it are installed