0

I would like to create a perl script which serves up an html page. Only one perameter needs to be passed to the script: something like http://www.website.com/page.htlm?1234

When a person types the above in their browser, they get a webpage. By typing in a differant number at the end, they get almost the same webpage with some modifications, all performed by the perl script.

Here is what I need help with:
1. A simple example script to build apon, which accepts the parameter, and based apon it replaces some word or phrase, then serves up a simple html webpage.
2. I need to know the details of how to set this up: where the script is physically located on the server (/cgi.bin)?
3. What does page.html look like (or does it need to be shtml)
4. Anything else I need to know...this is the first time i've attemted this.

I am somewhat familiar with perl and have written some data extraction routines for use locally but have never written anything which runs on a server. So any information in this regard would certainly be usefull.

2
Contributors
2
Replies
3
Views
11 Years
Discussion Span
Last Post by rpuskarcik
0

Its reasonably easy if you already know perl. And especially so if you are familiar with the webserver you are using. I only really know how it is done on a linux apache server, but I suspect that it is fairly similar with a windows apache or iis server.

The perl script is written the same way as you would write a perl script to run from your command line... but to execute it on your server, you will need to declare the path or alias for apache, so it knows to execute a request. This is usually some path including /cgi or /cgi-bin. A quick google search reveals the following pages which are more informative:

http://www.thesitewizard.com/archive/addcgitoapache.shtml

http://www.wdvl.com/Authoring/Languages/Perl/PerlfortheWeb/parent_process.html

I believe that you do not have to declare that pl or cgi files will be processed, you may declare that any file will be processed (or add html, shtml to the types as well). Though I believe this indicates that all html files must be cgi scripts, which may make your website development a rather long process. Much simpler to build only a few cgi files.

0

Thank's for the info. What I've gathered so far, is that the host I am using does use apache and has set up a cgi-bin directory. I supose I put me perl script in that directory as "makepage.pl" let's say. But then when a person goes to http://www.website.com/page.htlm?1234, what code in that page will actually invoke the script such that page.html is never actually seen, but instead the makepage.pl script's page is seen instead.

My concern about this is based on something I experienced where another programmer provided a script for me to use (hidden, so I have no idea what he had done) but when I went to the page, it served up the html as a text document. I want to avoid this if possible. And I definitely want to use my host server.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.