Hi: Well, I took a lesson from the experts. When you're so stupid to put
stuff on your computer without RTFM, then you deserve the pain. Then,
following the appropriate waiting/suffering period, the experts say, OK, now
then, go back to the beginning, and reinstall everything.
Well, I reinstalled the DBI and DBD::Pg and life is good.
Thanks for your kind assistance, everyone.
Tom
The script is from working with: Programming the Perl DBI, by Alligator
Descartes and Tim Bunce
#! /usr/bin/perl5.6.0 -w
#
# ch05/prepare/ex1: Simply creates a database handle and a statement
#handle
use strict;
use DBI;
### The database handle
#my $dbh = DBI->connect('dbi:Pg:dbname=tomdb', {
my $dbh = DBI->connect('DBI:Pg:dbname=tomdb');
#RaiseError => 1
#} );
### The statement handle
my $sth = $dbh->prepare( "SELECT * FROM friend" );
$sth->execute();
while (my $ref = $sth->fetchrow_hashref()) {
print "Found a row: firstname = $ref->{'firstname'}, lastname =
$ref->{'lastname'}, city = $ref->{'city'}, state = $ref->{'state'}, age =
$ref->{'age'}\n";
}
$sth->finish();
# Disconnect from db
$dbh->disconnect();
exit;
Changing the shebang line, we get this to work as well:
#! /usr/local/bin/perl -w
#
# ch05/prepare/ex1: Simply creates a database handle and a statement
#handle
use strict;
use DBI;
### The database handle
#my $dbh = DBI->connect('dbi:Pg:dbname=tomdb', {
my $dbh = DBI->connect('DBI:Pg:dbname=tomdb');
#RaiseError => 1
#} );
### The statement handle
my $sth = $dbh->prepare( "SELECT * FROM friend" );
$sth->execute();
while (my $ref = $sth->fetchrow_hashref()) {
print "Found a row: firstname = $ref->{'firstname'}, lastname =
$ref->{'lastname'}, city = $ref->{'city'}, state = $ref->{'state'}, age =
$ref->{'age'}\n";
}
$sth->finish();
# Disconnect from db
$dbh->disconnect();
exit;
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]