|
Helping ordinary people create extraordinary websites! |
Build a Perl/CGI Voting SystemBy Allan Peda2005-07-05
Details: File layout Installation requires three types of directories on the Web server:
Also note that permissions will most likely need to be tweaked so that the Web server can write to the directory for the DBM files. Listing 2 shows the creation of some typical directories on the Web server. Listing 2. Setting up directories on the Web server
Strictly speaking, only the cgi-bin (/var/www/cgi-bin) and DBM (/var/www/db) directories are absolutely essential, since they hold the script executable and the voting data, respectively. The layout shown in Listing 1 is specific to Linux, and the user and group names of the Web server process may vary, but the essential point is that there are several components that need to be placed in the correct area of the file system to be available to the Web server. After copying the support files into their respective directories, be sure to update any aliases in the Web server configuration files such as httpd.conf. After creating the directories as described in Listing 2, copy the files from the ZIP file into the analogous subdirectories on your system. Most importantly, the ballot, DraftBallot.pm, BallotBox.pm, and CastBallot.pm files should be in the cgi-bin directory. Only three nonstandard Perl modules are required; the process of installing them is presented in Listing 3 (see the modules' README files for more details). Listing 3. Installation of Perl modules
Tutorial Pages: » Using locked DBM files with CGI-driven forms saves client data without DBMS overkill » CGI considerations: Simplicity vs. complexity » Functional design considerations » Details: Hash keys » Details: E-mail gotchas » Details: Not-so-secret ballots » Details: File layout » Details: Static vs. dynamic DNS » Details: Is GET harmful? » Other possible improvements » Conclusion » Resources First published by IBM DeveloperWorks
|
|