ONJava.com -- The Independent Source for Enterprise Java
oreilly.comSafari Books Online.Conferences.

advertisement

AddThis Social Bookmark Button
Article:
  Apache Web-Serving With Mac OS X, Part 5
Subject:   Do it over again with Perl
Date:   2002-03-13 20:51:56
From:   morbus
Response to: Do it over again with Perl

Ultimately, you'll want to either look at or join the osx@perl.org list. You can see the archives here (there are some mentions of DBI).


I've gone through a lot of Perl installations on my perl box, so, in my case, I just had to:


sudo perl -MCPAN -eshell
install Bundle::DBD::mysql


Sat through a few errors, and when things were all finished, this script worked correctly (it assumes the database has been created as per the PHP script, and that some data has been entered).


#!/usr/bin/perl
use DBI;


$dsn = "DBI:mysql:database=test;host=127.0.0.1;";
$dbh = DBI->connect($dsn, "root", "");
$sth = $dbh->prepare("SELECT * FROM wisdom");
$sth->execute;
while (my $ref = $sth->fetchrow_hashref()) {
print "$ref->{'id'}: $ref->{'author'} sez: $ref->{'wisdom'}\n";
}
$sth->finish;


1 to 1 of 1
  1. Do it over again with Perl
    2002-03-18 19:45:57  gskluzacek [View]

1 to 1 of 1