![]() |
Perl and CGIPERL is another of those open sourced things, this time its a scripting language, a bit like Javascript. Perl is extremely powerful and has been used on Unix platforms for years. Web programmers can make use of Perl by writing Perl scripts for the server and calling them from within the downloaded web pages, almost the same as PHP. Perl scripts for the web are usually saved as text files with a .cgi extension and usually in a special 'cgi-bin' directory, specially for executable files. As PHP is easier to use and more user-friendly, its probably not worth learning Perl. Contact me for some good reference material if you want. WarningBy giving the server, files that are executable, some clever bleeders can tap into your server and cause havoc. There are safeguards for this but be aware. PHP is safer for server side scripts. InstallingPerl is straight forward to install, and should run with Apache fairly quickly. 1. Download the latest from www.perl.org.
Install it to c:\perl. Go with all of the defaults. 3. If Perl is working, double clicking on hello.cgi will open a dos command window, execute the script then close the window.. good, its working but not very useful. To see what is happening you need to open a dos command window, through the start menu>programs>MS Dos prompt. 4. At the prompt 'type perl -h' (without the quotes). A scree of help commands should come up. If 'bad file name' comes up then you must add the Perl directory to your path in your autoexec.bat file. If you installed Perl to c:/perl then at the prompt type 'c:/perl/perl -h', this should work, if not there is something wrong with the Perl installation. 5. By using cd to change directories to where you saved the hello.cgi, type 'perl hello.cgi' and html of hello world should scree past (or 'c:/perl hello.cgi' if the path isn't set). The dos command window is a useful, though awkward place, to debug scripts. 6. If you are running the server on your machine then the following should
work: In your internet browser click on hello.cgi. You should see; Hello.cgi#!/usr/bin/perl |
||
![]() |
Contact
information for Websalive Postal address: Scotland, UK: 113 Comiston Road, Edinburgh, EH10 6AQ Electronic mail: Support, Sales, General Information: Last modified: August 14, 2006 |