×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

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

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

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

(OP)
Why does the MS Notepad application startup with my CGI scipt in it every time I request it to execuite?  I obviously would prefer to see the output of the perl program rather see it in the notepad application.

I've done some limited perl CGI files on a unix web server.  Now I'm trying to execute an already working perl cgi program on my own web server.

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).

I have executed the cgi perl script from the DOS prompt...and it runs just fine (expected results).


The problem I run into is that every time I try and execute a perl script called "example.cgi" from my internet explorer browser, the notebook application start running and it brings up the file "example.cgi" for editing.

I've check to make sure the file is named "example.cgi" ...and doesn't have a .txt on the end.

Here is the contents of "example.cgi"

&get_form_data;
print "Content-type: text/html\n\n";

$file="$FORM{'lastname'}"¦¦print "Failed to assign $file,$!<BR>\n";
$password="$FORM{'password'}"¦¦print "Unable to assign
$password,$!<BR>/n";
$request="$FORM{'request'}"¦¦print "Unable to assign $password,$!<BR>/n";
open(OUT,">$file")¦¦print "Failed to open $file,$!<BR>\n";

print "<HTML>\n<BODY>\n";
print "</BODY>\n";
print"<p>Your data has been successfully sent to the web
server\n</p>";
print OUT "success";
print OUT $lastname;
print OUT $password;
print OUT $request;
close(OUT)¦¦print "Failed to close $file, $!<BR?\n";
exit;


sub get_form_data
{
  #Get the input
  read(STDIN, $buffer, $ENV{ 'CONTENT_LENGTH' } );
  #Split the name-value pairs
  @pairs = split(/&/, $buffer);
  foreach $pair (@pairs)
  {
    ($name, $value) = split(/=/, $pair);
    # Un-webify plus signs and %-encoding
    $value =~ tr/+/ /;
    $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
    $value =~ s/<v!--(.¦\n)*-->//g;
    $FORM{ $name } = $value;
  }
}


Here is HTML program that references the above CGI file:


<html>

<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>New Page 1</title>
</head>

<body>

<form method="POST" action="cgi-bin/example.cgi">
  <p>Lastname: <input type="text" name="lastname" size="20"></p>
  <p>Password: <input type="text" name="password" size="20"></p>
  <p>Request:    <input type="text" name="request" size="20"></p>
  <p> </p>
  <p><input type="submit" value="Submit" name="B1"><input type="reset" value="Reset" name="B2"></p>
</form>

</body>

</html>



Any Ideas???   Help?

Jerry



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

I'm a perl unix person rather than NT - but can you do something like this?

action="perl cgi-bin/example.cgi"

Mike
Mike_Lacey@Cargill.Com
Cargill's Corporate Web Site
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?"

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

(OP)
Mike,

good idea!  

I did try it but nope....didn't work.  The error I got was "Internet Explorer cannot open the Internet site "C:\Inetpub\wwwroot\perl cgi-bin\example.cgi".

So, it thinks 'perl cgi...' is part of a path vice command.

Any other ideas?  I feel like I'm real real close here to getting it to work....

Jerry

action="perl cgi-bin/example.cgi"

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

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

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

(OP)
Stingman1:

I'm not familiar with how to associate an extension with an application.  In this case I'd like to have the extension '.cgi' be related to perl....or other cgi type language.

I just looked through some books....it's clearly not a hot topic.....

I've used NT a lot....but have never run into this problem before .....  any ideas?

Jerry

p.s.  which version of PERL is best on W2000 server?  I'm loading another computer with windows2kserver to try it out?

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

Go to www.activestate.com 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

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

(OP)
Stingman1:

Thanks, will try it.  It did load active perl last night...I believe from a different web site.  The exact version is "ActivePerl-5.6.0.613".  I suspect this is the latest version...so I'll go forward with the other association suggestions u mentioned.   Will post back later tonight.

jerry

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

(OP)
Works!!!

Just as you suggested I needed to change the extension from 'cgi' to '.pl'.

The .pl tells the os to execute perl.

Much thanks....


Jerry

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close