Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Unwanted line (CGI question)

by ggvaidya (Pilgrim)
on Oct 21, 2008 at 11:46 UTC ( #718455=note: print w/replies, xml ) Need Help??


in reply to Unwanted line (CGI question)

Hi Yafeng,

What do you get if you execute action.cgi from the command line? I don't have CGI::Application set up here, so I can't try it out myself; but I'd love to help figure out what's going on.

cheers,
Gaurav

Replies are listed 'Best First'.
Re^2: Unwanted line (CGI question)
by xiaoyafeng (Chaplain) on Oct 21, 2008 at 12:07 UTC
    Hi Gaurav,

    Below is the output:

    C:\CGI_test>perl action.cgi Content-Type: text/html; charset=ISO-8859-1 <html> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1 +" /> </head> <body> </body> </html>
    Thanks for your help!

    I am trying to improve my English skills, if you see a mistake please feel free to reply or /msg me a correction
      I wouldn't worry too much about this. It's an instruction to the browser telling it what character set is being used to construct the page, in this case the 191 character Latin alphabet. Wikipedia will tell you more about this. You can also run a search for Meta tags in HTML, which will provide you with a bit more information on what they are and why they are present.
      That's what you should get. If you run your script as a CGI script, it is necessary for that line to be there. It won't appear in the browser. If it does, you're not running your script as a CGI script, so you have a server configuration issue.
      What ikegami said is correct. Running the script from the command line will display the Content-Type line. When you run the script in a web browser that line is used by the browser to know what type of content it should display, i.e. text/html, and the rest of the output renders in this format. So everything is working alright :) You can alter the Content-Type (using the header_add or header_props methods of CGI::Application) to other kinds, e.g. application/pdf or text/csv or whatever you like, and your web browser will react accordingly, i.e. either render the output in the browser, or ask you to save the file, or launch the application used to view that kind of file. Because the default Content-Type is text/html your web browser displays the subsequent output as a web page. Here's one page that lists a lot of Content Types (also known as MIME Types): http://www.w3schools.com/media/media_mimeref.asp

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://718455]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (8)
As of 2019-05-25 21:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you enjoy 3D movies?



    Results (152 votes). Check out past polls.

    Notices?
    • (Sep 10, 2018 at 22:53 UTC) Welcome new users!