December 2002
Intermediate to advanced
496 pages
9h 40m
English
CGI using Perl is straightforward. If you can write a Perl program to print “hello, world!” you’re halfway there. So, to be consistent with previous first examples (and because we haven’t chanted the mantra in a while), let’s start with “hello, world!”. Change to the proper directory that contains the server’s CGI programs:
$ cd /var/www/cgi-bin
Create the file hello.cgi, which contains the following text: [2]
[2] The file extension is a matter of style (or lack thereof); we use .cgi for the CGI programs in this book. Another logical option might be the .pl extension, because the program is Perl, but we’ll maintain a somewhat artificial distinction between plain-Jane Perl scripts and CGI web scripts.
#!/usr/bin/perl ...
Read now
Unlock full access