Well, if you are able, run the script from the command line. If your program fails to compile, that may be the problem.
Quick checklist:
- Correct permissions.
- Correct shebang line
- In the correct directory?
- Is a particular extension required (i.e., do you have myprog.pl instead of myprog.cgi)?
Another thing to do (in test only, don't use this for production), is to add the following line to the script:
use CGI::Carp qw(fatalsToBrowser);
If your script actually gets as far as compiling and the program tries to run, this will output the error messages to your browser, which aids debugging. Make sure that you take this out when you move the code to production as there is no sense in giving hackers additional information.
From what you are describing, it sounds like the problem is not with your code, but with the configuration. You have your code in the wrong place or something.
Is there any chance that you made corrections to your code that you forgot to upload to the server? | [reply] [d/l] |
Ovid, when I added the line
use CGI::Carp qw(fatalsToBrowser);
I got an error: Software error:
Can't locate object method "new" via package "CGI" at .......
So I presume that the program is compiling. And when I run it from the command line it's all good. Thanks a lot for helping a very bad perl programmer.
| [reply] [d/l] |
#!/usr/bin/perl -Tw
use strict;
use CGI;
use CGI::Carp qw(fatalsToBrowser);
my $query = new CGI;
# the rest of your code goes here.
Note that use CGI; is before the new CGI; assignment.
Also notice the -T switch on the command line. That's for "taint checking." You're going to hate this, but you really need to read perlsec and understand what's going on. If you start learning this early, you will save yourself a lot of problems down the road.
Cheers,
Ovid
P.S.: Don't think of yourself as a bad Perl programmer, think of yourself as a new Perl programmer. There's a difference :) | [reply] [d/l] |
I ran it (without any modifications) on my intranet webserver. It's an HP-UX running Netscape Suitespot server, if that helps. :-)
Mick | [reply] |