Perl Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPerl Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old March 6th, 2001, 07:46 PM
dermotb dermotb is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2001
Posts: 1 dermotb User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
I've just installed activeperl on IIS5 and everything runs smooth from the command line, however in the browser, i get;

CGI Error
The specified CGI application misbehaved by not returning a complete set of HTTP headers. The headers it did return are:


My test

I can't find any reference to this prob in th docs.

Thanks,

db


Reply With Quote
  #2  
Old March 7th, 2001, 09:02 AM
dsb dsb is offline
PerlGuy
Dev Shed Novice (500 - 999 posts)
 
Join Date: Jan 2001
Posts: 714 dsb User rank is Sergeant Major (2000 - 5000 Reputation Level)dsb User rank is Sergeant Major (2000 - 5000 Reputation Level)dsb User rank is Sergeant Major (2000 - 5000 Reputation Level)dsb User rank is Sergeant Major (2000 - 5000 Reputation Level)dsb User rank is Sergeant Major (2000 - 5000 Reputation Level)dsb User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 2 Days 15 h 44 m 20 sec
Reputation Power: 36
Send a message via AIM to dsb
Talking

It doesn't look like you included the headers that the app did return.
HTTP Headers are the parts of every web page transeferred that ask for/receive the correct page. In an HTTP request they indicate the name of the file that is wanted as well as any QUERY_STRING information. It also indicates the host name that should have the desired file. In the HTTP Response, the status line indicates the success or failure of the Request/Response, and the Content line indicates, you guessed it, the content of the page(eg., Content-Type: text/html )

This last line is a MUST in any CGI script using perl. You have to include at least the Content-Type header in the response. This, as far as I can see, is the source of many errors related to premature header endings.

Solution. If you are using CGI.pm then you simply have to use the 'header' function with the content-type as its lone argument:
Code:
#!/usr/bin/perl -wT
$q = CGI->new();
print $q->header( "text/html" );

You have to print to make sure it goes to the 'output' file or requested page's source code.

If, however you are not using CGI.pm(which you most definitely should be), then you have use this:
Code:
#!/usr/bin/perl -wT

print <<EOF
Content-type: text/html

<HTML>
<BODY>
Your stuff here
</BODY>
</HTML>

EOF


This encloses you entire HTML code inside the 'EOF' delimiters for easier printing. Note that the first line is 'Content-type: text/html'. If this is not the first line, followed immediately by a blank line, you will get the header errors.

For a quick tutorial in CGI & CGI.pm, click here. You might find it very helpful.

Hope that helps.
__________________
- dsb -
Perl Guy

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPerl Programming > HTTP headers


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway