--- Paul Burkett <[EMAIL PROTECTED]> wrote:
> I'm running Solaris 7, it is a security camera system where you can choose
> certain cameras to be displayed on the internet. It uses a JavaPush cam
> plugin to display what the cameras are viewing. Basically I have it set up
> (I wrote the script in perl) that if you click on say Button "1" it will
> POST it to the script and the script will send print(DEV, "@01"). DEV is the
> serial device term/a (ttya). It works but it goes to another webpage saying
> "500 Internal Server Error" I heard that I need to enter "Content-type:
> text/html" but I don't know where. 

In a CGI script, any data that is printed to STDOUT goes to the Web server which in 
turn sends
this data to the browser.  "Content-type: text/html\n\n" is typically the last line of 
the headers
and comes *before* your script prints out anything to the body of the document.  Since 
the Web
server typically supplies the majority of the headers for your Web page, you usually 
just need to
print the content type and then print anything else that you need after that.  The 
CGI.pm header()
function does that for you (text/html) is the default:

  #!/usr/bin/perl -wT
  use strict;
  use CGI qw/:standard/;
  print header();
  # anything else printed comes *after* the header()

> Also I heard that there is an HTTP
> command called 204 that won't redirect the script to another page. You can
> see the webpage @ www.atglab.org just click on "Lab Cam" towards the upper
> right hand corner.

204 is an HTTP status code (sent in the headers) that a script can send saying that 
everything
went fine, but there is no need to update the page.  I've typically seen this used in 
Web pages
that have Javascript auto-submit form data in the background and let's the user 
continue reading
the page.

  #!/usr/bin/perl -wT
  use strict;
  use CGI qw/:standard/;
  print header( -status => '204 No Content' );
  # Don't print anything else with this status code

Cheers,
Curtis Poe

=====
Senior Programmer
Onsite! Technology (http://www.onsitetech.com/)
"Ovid" on http://www.perlmonks.org/

__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/

Reply via email to