Chapter 7
For all that is great about the CGI module, it has its detractors. The usual com
plaints fall along the lines of memory consumption, performance and sheer code
size. For these reasons there are many competitors to CGI.pm on CPAN CGI::Lite,
7
CGI::Minimal,
8
and CGI::Thin,
9
to name a few. These modules tend to start by
implementing just the core CGI functionality and grow slowly from there as the
author realizes that this or that CGI.pm function is really quite useful after all. Ulti
mately they may perform better and use less memory, but CGI.pm remains more
popular for a good reason it does everything a CGI programmer needs and it
does it well.
DBI
The DBI module, by Tim Bunce, provides Perl with an object oriented interface to
virtually every relational database system under the sun (MySQL, PostgreSQL,
Oracle, Sybase, and many more). DBI accomplishes this Olympian feat by relying
on database driver (DBD) modules to interface with individual databases. For
example, when you use DBI to talk to a PostgreSQL database, DBI loads the
DBD::Pg
10
module. If you want to connect to MySQL, the DBD::mysql
11
module is
loaded. Even CSV
12
files can be accessed through the DBD::CSV
13
module. There
are DBD modules available for all of the commonly used databases, and many of
the less common ones too.
Before DBI, uneven database connection libraries were the norm each
database had its own modules and they all worked (or didn't work) differently. Perl
was struggling to be useful for serious database software development. DBI provided a
great platform for database interface libraries, and turned Perl into a serious
database application programming environment.
DBI defines two interfaces a front end interface for users and a back end
interface for DBD module programmers. Regardless of the underlying DBD
module being used, the DBI front end interface remains the same. The benefit of
this system is that users can learn to use the DBI module and employ those skills to
access any database with a DBD driver. Also, code written to the DBI interface can
be easily ported between databases.
14
7. Written by Benjamin Low
8. Written by Benjamin Franz
9. Written by R. Geoffrey Avery
10. Written by Jeffrey Baker
11. Written by Jochen Wiedmann
12. Stands for Comma Separated Values, a text format commonly used to store tabular data
13. Written by Jeff Zucker
14. This would be much easier if databases all spoke the same dialect of SQL, but unfortunately
that is not the case.
168
footer
Our partners:
PHP: Hypertext Preprocessor Best Web Hosting
Java Web Hosting
Inexpensive Web Hosting
Jsp Web Hosting
Cheapest Web Hosting
Jsp Hosting
Cheap Hosting
Visionwebhosting.net Business web hosting division of Web
Design Plus. All rights reserved