If you don't know much about how to use CGI scripts in your web page, here is a very brief introduction.


Make sure you have installed first perl as noted in Setting Up.


Let's assume you want to create a web site with some forms. Do the following


1) Select "New html file" and enter the following.


<form action="cgi-bin/basic.cgi" method="GET">

Enter some text here:

<input type="text" name="text" size=30>

<input type="submit"><p></form>


This creates an input on your page for the user to enter text. Most Web-Editors allow you to create stuff like this automatically. Notice the GET method used here. When the user presses "Submit", the browser will call the URL:


Under the path you installed OptiPerl, you will find a folder "webroot" (like c:\program files\OptiPerl\webroot). Save your file there with the name "basic.html"


2) Select "New Script" and enter the following.



print "Content-Type: text/html\n\n";

print "Hello from script! <p>";

print "$ENV{'QUERY_STRING'} <p>";


Save in "webroot\cgi-bin" as basic.cgi.


Now time to run. Make sure that you have a check-mark on "Server/Internal Server Enabled" and the root path under "Server/Internal Server Root" is "c:\program files\OptiPerl\webroot" (or accordingly where you installed OptiPerl).


Also make sure "Server/Run with Server" is checked too.


Go back to your html document "basic.html" pressing the tab in the editor and press "F9" to run.

You should see the html document in the web browser. Enter something in the text box and press "Submit"


You should see the result in a dynamically created html page. That's the basics!

If you get an error, please make sure you read about "Setting Up".


3) Now to send this to an Internet server, you might need to change the first line (the location of perl on the web server). If your internet web server has cgi enabled with a cgi-bin directory contact your provider for what this line should be.


Also read more in the FAQ.







Top  Previous  Next