Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

Previous Appendix A
Perl CGI Programming FAQ
Next
 

A.2 Modules

Should I use the Perl CGI modules to code all my CGI scripts? Isn't it easier to do it myself?

It really depends on what you are trying to do. The CGI modules should generally be used for heavy-duty CGI scripts. For simple scripts, it is far easier and quicker to roll your own or use CGI Lite (current version is v1.62 https://bytor.engr.wisc.edu/pub/perl/cpan/authors/id/SHGUN/CGI_Lite-1.62.pm.gz). If you really want, you can even use the Perl 4 cgi-lib.pl library (https://www.bio.cam.ac.uk/web/form.html).

How do I figure out how xyz module works?

Most modules have manpages embedded within the module itself. If that is the case, you can use the pod2man script to view the manpage:

% pod2man module.pm | nroff -man | more  

What CGI or WWW libraries are available for Perl4? Which should I use, and why?

The most widely used CGI library for Perl 4 is cgi-lib.pl written by Steven Benner (https://www.bio.cam.ac.uk/web/form.html). It is very, very simple to use!

What CGI modules are available for Perl 5? Which should I use, and why?

CGI::* Modules

(https://www-genome.wi.mit.edu/WWW/tools/scripting/CGIperl/)

These modules allow you to create and decode forms as well as maintain state between forms.

CGI Lite

(https://bytor.engr.wisc.edu/pub/perl/cpan/authors/id/SHGUN/CGI_Lite-1.62.pm.gz)

An alternative to the CGI::* modules. It is a glorious Perl 5 version of cgi-lib.pl.

Both of these modules have the ability to decode the multipart/form-data encoding scheme.

Why are so many of these CGI Perl libraries object oriented? I don't know O-O programming. Aren't there simpler libraries for non-programmers to use? How hard can it be?

You can use cgi-lib.pl (https://www.bio.cam.ac.uk/web/form.html), which is not object oriented, because it was designed for Perl 4.

But, using the Perl 5 O-O libraries is a piece of cake! Here is a simple example that uses CGI Lite (https://bytor.engr.wisc.edu/pub/perl/cpan/authors/ id/SHGUN/CGI_Lite-1.62.pm.gz) to print out form data:

#!/usr/local/bin/perl5
use CGI_Lite;
print "Content-type: text/plain", "\n\n";

$cgi = new CGI_Lite ()
$cgi->parse_form_data ();
$cgi->print_form_data ();
exit (0);


Previous Home Next
Introduction Book Index CGI and the WWW Server

 
 
  Published under free license. Design by Interspire