homepage Welcome to WebmasterWorld Guest from 54.237.95.6
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Subscribe to WebmasterWorld
Home / Forums Index / Code, Content, and Presentation / Perl Server Side CGI Scripting
Forum Library, Charter, Moderators: coopster & jatar k & phranque

Perl Server Side CGI Scripting Forum

    
IE Opens .pl file instead of executing it
athirukk




msg:3322240
 9:35 am on Apr 26, 2007 (gmt 0)

After I write a simple Helloworld.pl the IE is not executing it, instead it opens a dialog with 'Open' 'Save' option. Wats wrong...?

 

phranque




msg:3322498
 3:05 pm on Apr 26, 2007 (gmt 0)

it's not being recognized as a cgi script.
try renaming it to helloworld.cgi and see if that's enough to make it work...

perl_diver




msg:3322819
 6:38 pm on Apr 26, 2007 (gmt 0)

and if cgi does not work it means the http server is not setup to execute scripts.

topr8




msg:3322825
 6:47 pm on Apr 26, 2007 (gmt 0)

welcome to WebmasterWorld

IE doesn't execute scripts!
a web server does, have you got a web server set up?

Dabrowski




msg:3323104
 10:17 pm on Apr 26, 2007 (gmt 0)

Assuming your server does execute Perl correctly, you'll need to tell the browser what type the file will be. You can do this in the script, by adding a mime-type definition before you start your html output.

You can tell if it's the server or the browser, use IE, download the script. Now, if the contents of the file is the actual script, then it's a server issue, if it contains the script output, i.e. the HTML code for your Hello World script, then the server has executed the script and likely you need the mime-type.

Try this:
print <<END_HTML;
Content-type: text/html;

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>

<head>
<title>Hello World!</title>
</head>

<body>
<p>Hello World!</p>
</body>

</html>
END_HTML

Without the mime-type the browser doesn't know that it's a HTML file. FF probably takes a guess, but it's only a guess. For instance, 'application/pdf' would be a PDF file, so IE would know to open it with Adobe. As IE doesn't recieve a known mime-type, it assumes it's something it can't handle, so prompts you to download the file instead. It should only download the output though as I described above.

Note the blank line between the mime-type and the HTML DTD? Very important. That bit tells the browser it's the end of the headers, and the start of the file content.

Let us know how you get on.

athirukk




msg:3323550
 9:20 am on Apr 27, 2007 (gmt 0)

Yes...its started working after I changed the Content-type from "Content-type: text/plain" to "Content-type: text/html".

Thanks folks!

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Perl Server Side CGI Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
© Webmaster World 1996-2014 all rights reserved