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

Hi, I'm probably in over my head but I am honestly trying to learn perl with this project. Anyhow, I'm pretty much a complete neophyte and I'm trying to run a script called apply.cgi which I inherited from someone else.

It starts with the following lines:

#!/usr/bin/perl -s BEGIN { unshift @INC,".","./Net"; } use Socket; use Net::SSLeay qw(get_https make_form post_https); $Net::SSLeay::ssl_version = 3;

Now when I comment them out, the script at least runs, but it certainly doesn't run correctly. I take it these lines have something to do with SSL? is there something immediately, obviously, inherently wrong with whats there or is it fine-and the problem lies somewhere else in the script?

I can be reached via ICQ too! 11578852. Cheers! And thanks to anyone who even bothers to look at this post.

Edit 2001-04-11 by tye

Replies are listed 'Best First'.
Re: Internal Server Error!
by Maclir (Curate) on Apr 11, 2001 at 06:10 UTC
    Now, we don't have all that much to go on but, the first thing you should do is look in your server error log. If you are using apache, then the log is normally:
    /usr/local/apache/logs/error_log
    Of course, your configuration may be different, but find out where it is logging errors. Then, run your script, and straight after the error occurs, look at the last few entries in the log. If your server is a unix machine, then the command:
    tail /usr/local/apache/logs/error_log
    will do the trick. Now sometimes these messages are not blindingly obvious, but this will at least point you in the right direction.
      use CGI::Carp qw(fatalsToBrowser);

      ...might be helpful too.
Re: Internal Server Error!
by Daddio (Chaplain) on Apr 11, 2001 at 05:22 UTC
    Looking at this little bit of code, the first thing I think is, is Net::SSLeay installed in the standard perl lib location on your system? If not, do you have a ./Net in your current directory? That is what stands out to me at first look, but I haven't played with Net::SSLeay too much yet...
Re: Internal Server Error!
by gregw (Beadle) on Apr 11, 2001 at 07:32 UTC
    Hmm, can you run it from the command line? Typically when I get Internal Server Errors, I try running my CGI script from the command line and I get a nice descriptive error very quickly. You can also look at the Apache error log as others have mentioned.

    Also, when you say "inherited", do you mean that you are maintaining it in the exact same directory as it came from, or have you moved it around the filesystem? That could also give you problems if you know it otherwise worked earlier.

Re: Internal Server Error!
by kha0z (Scribe) on Apr 11, 2001 at 09:12 UTC
    Additonally to looking at the error logs and running it from the command line. Try to use:
    #!/usr/bin/perl -wc
    To make sure that your syntax is good. Then follow by using:
    #!/usr/bin/perl -w
    The warning flag will alert you as to what module is failing or if anything else might be a problem. If you do not have access to the command line on the webserver, you might want to check with the local system administrator (unless that is you) to make sure that modules that this script uses are installed on the production machine that will execute your script.

    Good Hunting,
    kha0z