Solved

Document contains no data

Posted on 1997-08-17
7
159 Views
Last Modified: 2013-12-25
I have a form which updates a number of files. when the form is empty and I press submit everthing works fine.
Howver if I try to submit the form with data I get a netscape error document contains no data.

What is going wrong?

0
Comment
Question by:slat
7 Comments
 
LVL 2

Expert Comment

by:n3mtr
ID: 1829718
Netscape is trying to tell you that the CGI program is returning a blank document.  Nothing in it.  It seems when the script gets data it forgets to return a response.
Without more information, thats all I can say.
Whay script are you using? Did you write it yourself?  Can you post it here?(if its short)

0
 

Author Comment

by:slat
ID: 1829719
The cgi script is a bit complicated.
The relevant part does the following things.
1) the form contains a hiden field action=Modify, when the data is parsed using cgi-lib all the data in %in si passed to a subroutine for processing.

2) there 3 files are opened , then the data is processed then the data is written to the each of the files, an d the files clesed;
Here is the relevant code:

foreach $cle(@Env_Var::Total_options) {

           $array_nom = "Env_Var::" . $cle . "_ops";
           $vide_hash = "Env_Var::" . $cle . "_vide"; # whether a field can be empty or not
           $Sur_Prog = $BIN_DIR . $cle . ".pl"; # put in option for http progs
here ie . "H" . $cle ....
             # use strict 'refs';
         HERE: {

            for ($y=1; $y <= $Env_Var::Nombres{$cle}; $y++) {

                # local($op,$nom,$min,$jr,$mois,$hr, $alerte, $warn, $fich);
                if ($Env_Var::Nombres{$cle} > 1) { $op = "$cle" . "$y"} else { $op = $cle;}
                $nom = $op . "_nom"; #every thing being nom  must have a nom
                 next HERE if (($CHECKED_data{$nom} eq "") || ($CHECKED_data{$nom} eq "non"));
                $Cron_String = $Sur_Prog . " " . $nom_machine . " " . $Env_Var::KNOWN_HOSTS{$nom_machine}; # <-prog host os; reset every loop
                foreach $el (@{$array_nom}) {

                   # each field in the form becomes $cle . $y . $el, ie $op = $cle . $y .$el, and the data is written to the files, eg print FILE $data, "=", $data{$op}, "\n"; however the program never makes it passed the above for loop; I have put a subroutine which prints out a html page just before the loop followed by a next statement so the the loop is not processed, which worked; however, when I allow this loop to be processed I get the error ¨document contains no data¨ - note: there is no error in the error_log file ; also I have even tried replacing the symbolic array reference with a simple array, but I still got the same error;
           }  
         } #HERE
       }# total ops
# files close;
# subroutine to display a html page

} end of subroutine

- I realise this isn't very clear, but the full code is very long and complicated. However, I would be extremely grateful if you if
you have any inkling as to why it never gets passed the third for loop

Thanks
                           
0
 
LVL 2

Expert Comment

by:n3mtr
ID: 1829720
have you run: perl -cw script
to check the warnings for a possible problem?
0
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
LVL 5

Expert Comment

by:icd
ID: 1829721
You should also look at the error log on your server. It is likely you have a run-time error with your script which is causing it to fail. The error log is likely to tell you roughly which line of the script is failing.

0
 

Expert Comment

by:edl
ID: 1829722
All of the above advice is good.  When doing cgi, always do perl -c prog.pl.

And when a program like this is giving you problems you are probably going to have to go in debug mode.  Put a simple print statement in the beginning of your program then exit(1);

If that get's printed to the web browser, then you just have to start debugging your code.

0
 
LVL 8

Accepted Solution

by:
jhurst earned 100 total points
ID: 1829723
the message is caused by the fact that the script is presenting no data at all.  My guess is that when there is data in the form the script fails and so does not generate, or at least does not complete the output.

You need to run the same script directly at the shell and pass it the input required.  If your are using GET then you can merely set the QUERY_STRING environment variable with the data that you believe is being passed to the form.  If POST then you just input it.  In this mode you should see the output and/or error.  I would also consider re-directing the stderr so you can see if there is a reported error.
0
 

Author Comment

by:slat
ID: 1829724
thank you everyone for your assistance.

Yes the reason was that the cgi script was sending no data
back. There was an error in a subroutine, used to process the data.

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you get a (Blue Screen of Death), your system writes a small file called a minidump. Your first step is to make certain your computer is setup to record memory dumps. Right click My Computer, choose properties. Click on the advanced tab, an…
It is a general practice to get rid of old user profiles on a computer  in a LAN environment. As I have been working with a company in a LAN environment where users move from one place to some other place at times. This will make many user profil…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now