mwhiting has asked for the wisdom of the Perl Monks concerning the following question:
Hi Monks. I'm trying to use CGI::Session to use session variables for the first time. I can put the 'use CGI' instruction into my .cgi program fine, but 'use CGI::Session' gives me an internal server error.
What is the likely cause - is the CGI::Session module not installed with the perl at my isp? How might I get around this?
Re: CGI::Session isn't installed?
by wfsp (Abbot) on May 16, 2007 at 16:48 UTC
|
hi mwhiting,
...CGI::Session module not installed...
Possibly. Or one of its dependancies or a version of one of its dependancies (but that would show up later).
Try adding
use strict;
use warnings;
use CGI::Carp qw(fatalsToBrowser);
at the top of the script and see if that sheds any more light on the subject.
Show us a (short) example of what you are using.
update: fixed typos | [reply] [d/l] |
|
Software error:
Can't locate CGI/Session.pm in @INC (@INC contains: /usr/local/lib/per
+l5/site_perl/5.8.7/mach /usr/local/lib/perl5/site_perl/5.8.7 /usr/loc
+al/lib/perl5/site_perl /usr/local/lib/perl5/5.8.7/BSDPAN /usr/local/l
+ib/perl5/5.8.7/mach /usr/local/lib/perl5/5.8.7 .) at libsearch-mw.cgi
+ line 9.
BEGIN failed--compilation aborted at libsearch-mw.cgi line 9.
Here's my general code. It's a short program containing basically nothing so I can get this working. When it does I can splice it into what I'm working on.
#!/usr/bin/perl
use warnings;
use CGI::Carp qw(fatalsToBrowser);
use Cwd;
use LWP::Simple;
use CGI;
use CGI::Session;
my $cgi = new CGI;
my $sid = $cgi->param('CGISESSID') || undef;
my $session = new CGI::Session("driver:File", $cgi, {Directory=>'/tmp'
+});
It looks to me like the module is not there.
Thanks in advance.
Michael | [reply] [d/l] [select] |
|
That's correct, the module appears to not be installed. This leaves you with two courses of action:
1. Ask your ISP if they will install it for you. Many ISPs are willing to do this, but many more are not. So ask very nicely.
2. Since, AFAIK, this is a pure perl module, you could download it from CPAN, unzip it, and FTP the entire lib directory into the directory you're running your scripts from, most likely the cgi-bin.
__________
Systems development is like banging your head against a wall...
It's usually very painful, but if you're persistent, you'll get through it.
| [reply] [d/l] [select] |
Re: CGI::Session isn't installed?
by Polonius (Friar) on May 16, 2007 at 18:38 UTC
|
| [reply] |
Re: CGI::Session isn't installed?
by leocharre (Priest) on May 16, 2007 at 22:11 UTC
|
CGI::Session is not such an obscure module. Ask them (host) to install it. If they don't- and you plan on doing perl regularly- ditch 'em. Save these troubles for real 'obscure' or possibly problematic modules like Want or Smart::Comments (I've had fuzz installing these wonderful modules without root)
When you get to other modules later on.. You really should be using an ssh connection and the command line interface for cpan. This can work wonders on a hosted account.
| [reply] |
|
| [reply] |
|
Sounds to me like you're developing something that you need in various clients' hosting accounts- of their choosing.
I have experience with this. I would honestly do one of three things-
- host them yourself (rent a server, $150/$300 mo or so)
- pick the host for all your clients- questions asked, ok.. but you make the final decision.
- quit, seriously. Go find another job where management has some common sense.
We do general IT, and one of the things we do, is optionally manage client websites. I tried solving problems with installer scripts, etc etc. But after 5 sites, it gets hard... Actually, it gets messy and dangerous to your business. Things will break, and if you don't have a standard method of installation (cpan), things will break, it will be hard to update modules, clients will complain, management will complain, you will be in devhell.
Use the shell and cpan- or have the isp install the stuff- or do the hosting yourself. Otherwise you can't update the modules, can you? Sorry to go on about this, I just really think you're headed into a nightmare.
| [reply] |
|
|
|