The first time I looked at a Perl program, my reaction was "that is some ugly code." I still think Perl is an ugly language, but it sure is useful! I am amazed at how quickly you can construct a useful application with Perl.
After reading this chapter, you may think that Perl is great for quick-and-dirty programs, but not for serious applications. I would disagreelike any programming language, you can write incomprehensible code in Perl. But you can also write Perl scripts that are easy to understand and not too difficult to maintain. Include comments in your code. Avoid constructs that are difficult to understand. Perl often offers many ways to do any one thing: Use the most descriptive form, not the most cryptic.
One of the real benefits to the combination of Perl and PostgreSQL is that you can execute Perl scripts (accessing a PostgreSQL database) from within a web server. When you write Perl scripts intended to run within a web server, the script produces a new web page each time it executes. Because a Perl script can interface with PostgreSQL, you can generate dynamic web content on-the-fly.
I haven't covered web interfacing in this chapter, but Chapter 15, "Using PostgreSQL with PHP," shows you how to use PostgreSQL with the PHP web server scripting language.
Part I: General PostgreSQL Use
Introduction to PostgreSQL and SQL
Working with Data in PostgreSQL
PostgreSQL SQL Syntax and Use
Performance
Part II: Programming with PostgreSQL
Introduction to PostgreSQL Programming
Extending PostgreSQL
PL/pgSQL
The PostgreSQL C APIlibpq
A Simpler C APIlibpgeasy
The New PostgreSQL C++ APIlibpqxx
Embedding SQL Commands in C Programsecpg
Using PostgreSQL from an ODBC Client Application
Using PostgreSQL from a Java Client Application
Using PostgreSQL with Perl
Using PostgreSQL with PHP
Using PostgreSQL with Tcl and Tcl/Tk
Using PostgreSQL with Python
Npgsql: The .NET Data Provider
Other Useful Programming Tools
Part III: PostgreSQL Administration
Introduction to PostgreSQL Administration
PostgreSQL Administration
Internationalization and Localization
Security
Replicating PostgreSQL Data with Slony
Contributed Modules
Index