in reply to Debugging Perl .cgi forms

It's a little tough to tell what's happening from what you have given us. But here are a few things to check:

- are you using CGI.pm?
- have you printed a proper HTTP header at the top of your output?
- have you successfully produced a "Hello World" page to test your basic approach?
- have you included something like the following near the top of your script to help you trace your errors?

use CGI qw(:standard); use CGI::Carp; use CGI::Carp qw(fatalsToBrowser); local $SIG{__WARN__} = \&Carp::cluck;
If none of this gets you closer to a solution, slim down your script to the minimum that still produces the error and post both the script and the output you get when you run from the command line.

Replies are listed 'Best First'.
Re: Re: Debugging Perl .cgi forms
by nysus (Parson) on Apr 01, 2001 at 06:38 UTC
    I know the first 3 are all covered. I can get the script working, but I often make errors while modifying the script (I'm new at this) and that's when I get the ISE's.

    In regards to your last suggestion:
    --I have "use CGI;" at the top of my script
    --I have tried using CGI::Carp qw(fatalsToBrowser) but it didn't provide any useful information. I have never tried the other two lines (and don't know what they are) but I will slap them in there and see what happens.

    Thanks.

      nysus, is sounds like you are over the big hurdles. This is the point where I just proceed incrementally, adding more material a bit at a time until something goes wrong.

      If you get to a point where no amount of staring at the screen brings enlightenment, show us some code and output. We love looking at the real stuff.

      But be sure you 'use strict;' and have '-w' in your hashbang line or you will get gently (?) scolded.  ;-)

        Here it is by popular demand. I've only put in the code that I changed which broke the script. Look at the password setting to see my level of frustration. :)
        #!/usr/bin/perl -w use strict; use CGI; my $query = new CGI; my $error_message = ""; my $pwd = ""; ############################################### # # # Variable initiation # # # ############################################### my $form_submission_check = "Submit"; # Set to the +name of an object on the form ############################################### # # # Script program logic # # # ############################################### if ($query->param('cancel')) { &get_password; } elsif ($query->param('change1')) { &change_password(); } elsif ($query->param('change2')) { &process_change_password(); } else { $pwd = $query->param('password'); if ($pwd eq "suckmydick") { $pwd = 1; &form; } else { &get_password(); } }
        Thanks.
      I slapped those lines in there but get no extra info in my browser.