
|
|
|||
Build a Perl/CGI Voting SystemBy Allan Peda2005-07-05
Using locked DBM files with CGI-driven forms saves client data without DBMS overkill Many Web-deployed applications are written within elaborate database-driven server-side development frameworks such as PHP and Java™ servlets, but for simple applications (for example, where the entire dataset fits comfortably within a Web server's RAM), data persistence can be easily accomplished using locked DBM files in conjunction with the Perl MLDBM module. This article presents a real-world example -- a Web-based voting application -- that highlights the use of minimal external modules, forgoes using client-based cookies, and takes advantage of CGI attributes.It's no secret that software is becoming increasingly complex and that we are seeing additional layers added to systems in an effort to keep software components modular. The primary result should be that these systems are now easier to maintain and more scalable, yet sometimes these techniques are simply overkill that results in over-designed software. In other cases, developers choose an overly complex but well-known technology rather than investigate a simpler but less familiar alternative. After all, if all one has is a hammer, then every problem looks like a nail. I was recently asked to design a small program to tally election ballots for a university student organization. It was a simple project insofar as it was limited to serving no more than 500 students over the course of one week; afterwards, the results would be tallied and released. Since this project required an almost trivial level of service, there would be no benefit to passing queries to and from an external database. Instead, the script could rapidly read and write data structures directly. Still, I wanted to put something together that was a little bit better designed than a few pages of spaghetti code. I wanted a well-thought out, self-contained design that would also offer simplified deployment. 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
|
||||
| About the NetVisits, Inc Network | Write For Us | Advertise Copyright ©2007 NetVisits, Inc Network. All Rights Reserved. Privacy Policy. |
Visit other NetVisits, Inc. sites: |