Posted on 1997-04-17
Medium Priority
Last Modified: 2013-12-25
I am trying very hard to get my HTML script to call a simple Perl script.  What is happening is that when the HTML calls the Perl script, the Perl script is brought up in WordPad.  What is going on please ?

I am under the impression that as long as I have Perl on my system, I have no need to call out to my ISP's cgibin directory.



To follow up to your answers:

Thanks for your answers.  I have enclosed the scripts as you asked.  I altered the H_KEY_CLASSES_ROOT as suggested; sure enough WordPad.exe was in there, so I took it out.

Now when I run the guest.htm and press submit to call the Perl script, it tells me that :  "This file does not have a program associated with it for performing this action.  Create an association in My Computer by clicking View and then clicking options."  So I went there, and under .PL files, it just says that the action is open.  I also checked out my MIME setup in the Registry and there was nothing referring to .pl files, just an entry for html/text, which had a few fields in it that obviously meant something, but not to me.

Regarding the question about my ISP's cgibin directory, what I meant was, I should be able to get this all to run on my PC, as long as I have all the necessary bits and pieces, correct?  Do I need to specify the location of perl.exe and perl100.dll in my Registry?

Any further help is much appreciated !  Sorry about lack of points for the answer, I seem to be running a little short.


Here is my Perl script :

#! perl
print("My name is Yon Yonson,\n");
print("I live in Wisconsin,\n", "I work in a lumbermill there.\n");

Here is the HTML that calls it (First.pl)

<title> MOUSEPADKING Guestbook</title>
<body background="whamback.gif" vlink="#FF00FF">

<center><h2>Add to our Guestbook</h2></center>

Give us some feedback; what would you like on your mousepad ?

  Is there a favorite picture that you would like us to put on your pad for you?    

<b>Put some picture in your life !!!!</b>

<a href="list.htm"><font size=+1 color="#000000" face="Times New Roman"><b>BACK</b></font></a>

<table border=0 cellpadding=10>
<td>Your Name:</td>
<td><input type=text name=name size=30></td>
<td><input type=text name=email size=40></td>
<td valign=top>Comments:</td>
<td><textarea name=comments cols=60 rows=4></textarea></td>
<input type=submit value="Add Entry"><input type=reset>


Question by:topcat1
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 4
  • 2

Expert Comment

ID: 1827916
Can you list your HTML and perl script, as this sounds quite remarkable if true!

Expert Comment

ID: 1827917
Can you list your HTML and perl script, as this sounds quite remarkable if true!

Expert Comment

ID: 1827918
Can you list your HTML and perl script, as this sounds quite remarkable if true!
The Orion Papers

Are you interested in becoming an AWS Certified Solutions Architect?

Discover a new interactive way of training for the exam.


Accepted Solution

igroove earned 200 total points
ID: 1827919
Two things could be happening:

FIrst, on your machine:
What's happening is your browser is prolly thinking that the perl script mime type is text/plain or associates files of the type .cgi or .pl as text files, and therefore decides to "download" and "view" them rather than execute them.

You should look (in the registry) under .pl or .cgi in HKEY_CLASSES_ROOT,  and see the "long name" of a perl file. It's probably perlfile or plfile or cgifile.  Check under that key if there's a shell subbkey, and an open key, and a command key under that, ie:


It may reference wordpad.exe in it.  If so, remove it.
You may also have to look under your mime types for cgi/pl and remove it being text/plain or text/html.

If you're running a web server, you have to get it to recognize .cgi or .pl as scripts.  I run NT4 Server and Internet Information Server, so I had to go under it's registry and tell it .cgi meant go do perl.

Basically, that's what's happening on your local system.

Second, on your 'net providor's machine:

At your web hosting (ISP) it may be that you cannot run a script anywhere but their cgibin.  You may have to ask them about that.
If you can run one in your web home, then make sure that the file is EXECUTABLE.  What could be happening is that the server doesn't see that your CGI is an executable script.  You should set the mode of the CGI file to 755. (permissions), if your host is UNIX.  That means the file is READABLE and WRITEABLE and EXECUTABLE by you, the owner of the file, and only READABLE and EXECUTABLE by others. (rwxr-xr-x).  If this is confusing, you need to brush up on a little unix file permissions.

Basically, you gotta let the web server know your file is an executable script.  As i said b4, ask your providor. or consult your web server doc (if that's the case)

You didn't provide a lot of intel in your question, so I hope I've explained it :)

Author Comment

ID: 1827920
Edited text of question

Expert Comment

ID: 1827921
Ok, yes, you should be able to run it locally if you wish.  Here's some things you should do:

1)  Your first line of your script should read:

This is so that when you upload it to a server, the server will know where Perl is and stuff.

2)  If you're running Microsoft's Internet Information Service, you drill through the registry to get to:
HKEY_LOCAL_MACHINE/System/CurrentControlSet/Services/W3SVC/Parameters/Script Map/

Add a REG_SZ key ".cgi" with a REG_SZ value of "c:\Perl\Bin\Perl.exe %s %s" or your path to Perl.

This will tell IIS to run .cgi files w/Perl.

You should, even if you aren't running IIS, change .pl files for CGI to .cgi.

3) If you're not running IIS, check your server documentation for nessicary setup file/registry/.ini settings to get the server to run .cgi files w/perl.

4)Drill in your registry to:
HKEY_CLASSES_ROOT/.pl/ and see what the long name of file is (as before when you had to find it to remove wordpad).  Go to the HKEY_CLASSES_ROOT/plfile or whatever it specifies.

For HKEY_CLASSES_ROOT/perl(or whatever)/shell/open/command/ make sure the value is "perl.exe %1 %*" so that it will run .pl files with Perl in the shell.

Then add HKEY_CLASSES_ROOT/.cgi/ with the same value that HKEY_CLASSES_ROOT/.pl/ has.

You should, theoretically, now be able to do as you wish.

BTW, what Perl for win are you using PerlWin32?  To me, it's the best Perl port yet. :)

Happy scriptiing!

Expert Comment

ID: 1827922
Ok, to summarize the registry:

Assuming you have HKEY_CLASSES_ROOT/.pl/ pointing to "perl", and Perl.exe is in c:\Perl\Bin:

The registry values would be:
HKEY_CLASSES_ROOT/.pl/ = "perl"
HKEY_CLASSES_ROOT/.cgi/ = "perl"
HKEY_CLASSES_ROOT/perl/shell/open/command = "perl.exe %1 %*"

And if you're running IIS on NT4.+:
HKEY_LOCAL_MACHINE/System/CurrentControlSet/Services/W3SVC/Parameters/Script Map/ -- add a value named ".cgi" equal to "c:\Perl\bin\Perl.exe %s %s"


Expert Comment

ID: 1827923
Of course, c:\Perl\bin must be in your path...or wherever your perl binaries are.  Check your perl install docs to get it right.

That's all... :)


Expert Comment

ID: 1827924
Also, your perl script won't actually run from an HTML unless it's called VIA a server...but it'll run just fine standalone (ie, you type some_file_name.pl on the command line).  That may be the biggest problem you're having.  A browser itself cannot run a cgi script.  That's a server-side thing.

Hope this all clears it up for you.  If you need a server, try http://www.w3c.org/ and pick up their FREE httpd.  THey've got one that runs under Win32, and does a good job.


Expert Comment

ID: 1827925
Another web server you may want to try is Omni HTTPd. You can find it at:



Author Comment

ID: 1827926
I think that my problem is that I am trying to run it all on my machine.  I did not realize that a browser could not invike a Perl program; but then how was I supposed to know; I'm just a dumb Paddy.  Voodoo, just for you, I was a Fortran77 programmer in London for 3 years, back in the early 80s,  but California had my name on it, so now I experience the savours of American life! You both recommend servers for me to use, what is the difference between them and my ISP, Primenet ?

bye for now, topcat

Expert Comment

ID: 1827927
Fortran!  Hehe.  Reminds me of ......cp/m....forth....et al.

HTTP servers are basically the same, save for different ways they handle server side includes and stuff.

JavaSoft has a really cool one called Jeeves that will run Java "servlets" - Java applets that run server side instead of on a client!  Pretty phat if you ask me.

And ColdFusion is a good server too.  I use Microsoft's IIS locally, but my pages are hosted on a Linux box running a stock httpd, so really cool server side scripting is basically nil.

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
A quick Powershell script I wrote to find old program installations and check versions of a specific file across the network.
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

800 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question