July 2005
Intermediate to advanced
1032 pages
27h 10m
English
Before you try to connect to a PostgreSQL server, take a moment to examine the basic components of a typical Perl/DBI script.
Listing 14.1 shows a Perl script that will print the list of available DBD drivers.
1 #!/usr/bin/perl -W
2 #
3 # Filename: get_drivers.pl
4 #
5 use strict;
6 use DBI;
7
8 # Get the list of drivers from the DBI
9 #
10 my @driver_names = DBI->available_drivers();
11
12 # Print the name of each driver
13 #
14 foreach my $driver ( @driver_names ) {
15 print( "Driver: $driver\n" );
16 }
|
The first line of the script identifies this file as an executable. When you run a program on Unix/Linux systems, or if you are using Cygwin in the Windows environment, a script ...
Read now
Unlock full access