Gossamer Forum
Home : General : Perl Programming :

CGI application misbehaved by not returning a complete set of HTTP headers

Quote Reply
CGI application misbehaved by not returning a complete set of HTTP headers
Hi
I am getting a eorror when I am trying to Run perl/cgi program. I am pasting the code with this mail.
when i am running this program i am getting error
quote"
The specified CGI application misbehaved by not returning a complete set of HTTP headers. The headers it did return are:

Name "V::number1" used only once: possible typo at c:\cg\cal.pl line 8.
Name "V::number2" used only once: possible typo at c:\cg\cal.pl line 8.
Sum Of two numbers are 6
"unquote
plz help me out
quote"
this is the html page
<HTML>
<HEAD>
<TITLE> PERL </TITLE>
</HEAD>
<form action = "http://localhost/manish/cal.pl" method = "get";
<br>
Enter First Number
<input type=text name=number1>
<br>
Enter Second Number
<input type=text name=number2>
<br>
<input type=submit value="calculate sum">
</form>
</BODY>
</HTML>

this is the perl file
#!/usr/bin/perl
use strict;
use warnings;
use CGI;
my $query = new CGI;
$query->import_names('V');
my $sum;
$sum = $V::number1 + $V::number2;
print "Sum Of two numbers are $sum";
"unquote
Quote Reply
Re: [mkishore] CGI application misbehaved by not returning a complete set of HTTP headers In reply to
Mmm.. what is "$query->import_names('V');
" all about?

I would just use;

Code:
#!/usr/bin/perl

use strict;
use warnings;
use CGI;

my $query = new CGI;
print $query->header();
my $sum;
$sum = $query->param('number1') + $query->param('number2');
print "Sum Of two numbers are $sum";

The bit in red is where your main problem lies. You need to print out a header first, or it will just give a 500 IS Error :)

Hope that helps.

Cheers

Andy (mod)
andy@ultranerds.co.uk


IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates
Quote Reply
Re: [Andy] CGI application misbehaved by not returning a complete set of HTTP headers In reply to
Thx Andy..
It is workng now.
Quote Reply
CGI Error In reply to
Hi Andy..
I am gettting Stupid Error. I am sending this mail to u spl coz u had heled me out on previously also.
I am using the Acitve Perl 5.6.1 on windows 2000 professional.
I am just pasting the code here.

Quote:

#!/usr/bin/perl
use warnings;
use strict;
use CGI;
my $q = new CGI;
print $q->header,
$q->start_html( 'Hello Manish!'),
$q->h1('Hello' ),
$q->end_html;


please let me know where i am making mistake here.

Thanks
Manish
Quote Reply
Re: [mkishore] CGI Error In reply to
Hi. Why are you doing this?

Code:
$q->start_html( 'Hello Manish!'),
$q->h1('Hello' ),
$q->end_html;

I would do either;

Code:
print $q->start_html( 'Hello Manish!'),
$q->h1('Hello'),
$q->end_html;

,...or;

Code:
print $q->start_html( 'Hello Manish!');
print $q->h1('Hello');
print $q->end_html;

Hope that helps.

Cheers

Andy (mod)
andy@ultranerds.co.uk


IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates
Quote Reply
Re: [mkishore] CGI Error In reply to
Andy..
I tried with ur method .but even then also i am getting error.
This the error which I am getting
Quote:

"$Id: CGI.pm,v 1.49 2001/02/04 23:08:39 lstein Exp $" is not exported by the Car
p module at C:/Perl/lib/CGI.pm line 21
Can't continue after import errors at C:/Perl/lib/CGI.pm line 21
BEGIN failed--compilation aborted at C:/Perl/lib/CGI.pm line 21.
Compilation failed in require at a1.pl line 4.
BEGIN failed--compilation aborted at a1.pl line 4.
Quote Reply
Re: [mkishore] CGI Error In reply to
Looks like it may be an error inside CGI.pm itself. Afraid I wouldn't know what/how though :(

Cheers

Andy (mod)
andy@ultranerds.co.uk


IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates
Quote Reply
Re: [Andy] CGI Error In reply to
Andy then this case when U suggest me?
Do I need to download new CGI.pm ?

I am a beginner so plz help me
Quote Reply
Re: [mkishore] CGI Error In reply to
Yeah, I would suggest just reinstalling CGI.pm.

Alternativly, buy a bit of cheap hosting (there are deals out there for as little as $5US/month), as they should have all this kinda stuff already srt up for you Wink

Cheers

Andy (mod)
andy@ultranerds.co.uk


IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates
Quote Reply
Re: [mkishore] CGI Error In reply to
#!/usr/bin/perl -wT
use warnings;
use strict;
use CGI;
my $q = new CGI;
print $q->header,
$q->start_html( 'Hello Manish!'),
$q->h1('Hello' ),
$q->end_html;

Try this and use chmod 0755 "filename.cgi" and use ./filename.cgi in command prompt.
It works for me