Perl Libraries
Using Libraries
-
The next step in your evolution as a CGI programmer
is to learn how to customize scripts for your own needs. Thus, the first
task is to understand how CGI programs are structured.
-
Many CGI programs use a common toolbox of routines-called libraries.
Thus, it is helpful to understand how libraries work
-
Web applications are not ferocious. After a bit of delving into the lines
of code, you'll often find that a well-written program can be tame.
-
It's a good idea to view programs as a group of associated algorithms
(or routines), all of which have small, well-defined functions. Algorithms
are like ants in an ant colony, each doing one small job well.
-
To decipher a program, you need only focus on understanding how these simple
packets of code, called subroutines, interact. With practice, they will
call out to you: "I add numbers," "I gather form input," "I parse that
input," "I say hello world when asked." If you understand the program one
routine at a time, the application's design will emerge and you will be
more comfortable modifying and adding to the original program.
-
There are three types of algorithms that you will be faced with in most
Perl CGI
applications: individual algorithms, application-specific subroutines,
and interapplication libraries. Let's look at each of these types.
Additional Resources:
Getting
Information About a File With stat
Table of Contents
Perl Algorithms
|