Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Microsoft Note starts up whenever I request a perl script to execute?? 2

Status
Not open for further replies.

jbs

Programmer
Feb 19, 2000
121
US
Why does the MS Notepad application startup with my CGI scipt in it every time I request it to execuite?&nbsp;&nbsp;I obviously would prefer to see the output of the perl program rather see it in the notepad application.<br><br>I've done some limited perl CGI files on a unix web server.&nbsp;&nbsp;Now I'm trying to execute an already working perl cgi program on my own web server.<br><br>The web server is a NT Server 4.0 with IIS (service pack 5 loaded as well as IIS from option pack-4 and active perl).<br><br>I have executed the cgi perl script from the DOS prompt...and it runs just fine (expected results).<br><br><br>The problem I run into is that every time I try and execute a perl script called &quot;example.cgi&quot; from my internet explorer browser, the notebook application start running and it brings up the file &quot;example.cgi&quot; for editing.<br><br>I've check to make sure the file is named &quot;example.cgi&quot; ...and doesn't have a .txt on the end.<br><br>Here is the contents of &quot;example.cgi&quot;<br><br>&get_form_data;<br>print &quot;Content-type: text/html\n\n&quot;;<br><br>$file=&quot;$FORM{'lastname'}&quot;¦¦print &quot;Failed to assign $file,$!&lt;BR&gt;\n&quot;;<br>$password=&quot;$FORM{'password'}&quot;¦¦print &quot;Unable to assign<br>$password,$!&lt;BR&gt;/n&quot;;<br>$request=&quot;$FORM{'request'}&quot;¦¦print &quot;Unable to assign $password,$!&lt;BR&gt;/n&quot;;<br>open(OUT,&quot;&gt;$file&quot;)¦¦print &quot;Failed to open $file,$!&lt;BR&gt;\n&quot;;<br><br>print &quot;&lt;HTML&gt;\n&lt;BODY&gt;\n&quot;;<br>print &quot;&lt;/BODY&gt;\n&quot;;<br>print&quot;&lt;p&gt;Your data has been successfully sent to the web<br>server\n&lt;/p&gt;&quot;;<br>print OUT &quot;success&quot;;<br>print OUT $lastname;<br>print OUT $password;<br>print OUT $request;<br>close(OUT)¦¦print &quot;Failed to close $file, $!&lt;BR?\n&quot;;<br>exit;<br><br><br>sub get_form_data<br>{<br>&nbsp;&nbsp;#Get the input<br>&nbsp;&nbsp;read(STDIN, $buffer, $ENV{ 'CONTENT_LENGTH' } );<br>&nbsp;&nbsp;#Split the name-value pairs<br>&nbsp;&nbsp;@pairs = split(/&/, $buffer);<br>&nbsp;&nbsp;foreach $pair (@pairs)<br>&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;($name, $value) = split(/=/, $pair);<br>&nbsp;&nbsp;&nbsp;&nbsp;# Un-webify plus signs and %-encoding<br>&nbsp;&nbsp;&nbsp;&nbsp;$value =~ tr/+/ /;<br>&nbsp;&nbsp;&nbsp;&nbsp;$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack(&quot;C&quot;, hex($1))/eg;<br>&nbsp;&nbsp;&nbsp;&nbsp;$value =~ s/&lt;v!--(.¦\n)*--&gt;//g;<br>&nbsp;&nbsp;&nbsp;&nbsp;$FORM{ $name } = $value;<br>&nbsp;&nbsp;}<br>}<br><br><br>Here is HTML program that references the above CGI file:<br><br><br>&lt;html&gt;<br><br>&lt;head&gt;<br>&lt;meta http-equiv=&quot;Content-Language&quot; content=&quot;en-us&quot;&gt;<br>&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=windows-1252&quot;&gt;<br>&lt;meta name=&quot;GENERATOR&quot; content=&quot;Microsoft FrontPage 4.0&quot;&gt;<br>&lt;meta name=&quot;ProgId&quot; content=&quot;FrontPage.Editor.Document&quot;&gt;<br>&lt;title&gt;New Page 1&lt;/title&gt;<br>&lt;/head&gt;<br><br>&lt;body&gt;<br><br>&lt;form method=&quot;POST&quot; action=&quot;cgi-bin/example.cgi&quot;&gt;<br>&nbsp;&nbsp;&lt;p&gt;Lastname: &lt;input type=&quot;text&quot; name=&quot;lastname&quot; size=&quot;20&quot;&gt;&lt;/p&gt;<br>&nbsp;&nbsp;&lt;p&gt;Password: &lt;input type=&quot;text&quot; name=&quot;password&quot; size=&quot;20&quot;&gt;&lt;/p&gt;<br>&nbsp;&nbsp;&lt;p&gt;Request:&nbsp;&nbsp;&nbsp;&nbsp;&lt;input type=&quot;text&quot; name=&quot;request&quot; size=&quot;20&quot;&gt;&lt;/p&gt;<br>&nbsp;&nbsp;&lt;p&gt;&nbsp;&lt;/p&gt;<br>&nbsp;&nbsp;&lt;p&gt;&lt;input type=&quot;submit&quot; value=&quot;Submit&quot; name=&quot;B1&quot;&gt;&lt;input type=&quot;reset&quot; value=&quot;Reset&quot; name=&quot;B2&quot;&gt;&lt;/p&gt;<br>&lt;/form&gt;<br><br>&lt;/body&gt;<br><br>&lt;/html&gt;<br><br><br><br>Any Ideas???&nbsp;&nbsp;&nbsp;Help?<br><br>Jerry<br><br><br><br>
 
I'm a perl unix person rather than NT - but can you do something like this?<br><br>action=&quot;perl cgi-bin/example.cgi&quot;<br> <p>Mike<br><a href=mailto:Mike_Lacey@Cargill.Com>Mike_Lacey@Cargill.Com</a><br><a href= Cargill's Corporate Web Site</a><br>Please don't send me email questions without posting them in Tek-Tips as well. Better yet -- Post the question in Tek-Tips and send me a note saying "Have a look at so-and-so in the thingy forum would you?"
 
Mike,<br><br>good idea!&nbsp;&nbsp;<br><br>I did try it but nope....didn't work.&nbsp;&nbsp;The error I got was &quot;Internet Explorer cannot open the Internet site &quot;C:\Inetpub\ cgi-bin\example.cgi&quot;.<br><br>So, it thinks 'perl cgi...' is part of a path vice command.<br><br>Any other ideas?&nbsp;&nbsp;I feel like I'm real real close here to getting it to work....<br><br>Jerry<br><br>action=&quot;perl cgi-bin/example.cgi&quot;
 
Well the problem that you are having sounds more like an association problem as in it sounds like that the extension that you are using is setup to call notepad.exe instead of perl.exe
 
Stingman1:<br><br>I'm not familiar with how to associate an extension with an application.&nbsp;&nbsp;In this case I'd like to have the extension '.cgi' be related to perl....or other cgi type language.<br><br>I just looked through some books....it's clearly not a hot topic.....<br><br>I've used NT a lot....but have never run into this problem before .....&nbsp;&nbsp;any ideas?<br><br>Jerry<br><br>p.s.&nbsp;&nbsp;which version of PERL is best on W2000 server?&nbsp;&nbsp;I'm loading another computer with windows2kserver to try it out?<br><br>
 
Go to <A HREF=" TARGET="_new"> and get the latest version and install it and as for the file extension associations go to tools/folder options/File types and lookup the cgi extension and see what it says and after you install the latest version of perl then lookup the pl extensions and then copy those variables for the cgi extension and that should kill your problem
 
Stingman1:<br><br>Thanks, will try it.&nbsp;&nbsp;It did load active perl last night...I believe from a different web site.&nbsp;&nbsp;The exact version is &quot;ActivePerl-5.6.0.613&quot;.&nbsp;&nbsp;I suspect this is the latest version...so I'll go forward with the other association suggestions u mentioned.&nbsp;&nbsp;&nbsp;Will post back later tonight.<br><br>jerry
 
Works!!!<br><br>Just as you suggested I needed to change the extension from 'cgi' to '.pl'.<br><br>The .pl tells the os to execute perl.<br><br>Much thanks....<br><br><br>Jerry<br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top