Thursday, March 26, 2009
DBD::Google - Treat Google as a datasource for DBI
Somehow all of our information ends up on Google. Now we can treat Google like a database and query it with SQL just like a simple database:
#!/usr/bin/perl -w
use strict;
use warnings 'all';
use DBI;
use Data::Dumper;
my $key = 'ABQIAAA...-P_bCg';
my $dbh = DBI->connect("dbi:Google:", $key);
my $sth = $dbh->prepare('SELECT title, URL FROM google WHERE q = "perl"');
$sth->execute();
while( my $rec = $sth->fetchrow_hashref )
{
warn Dumper( $rec );
}# end while()
$sth->finish();
$dbh->disconnect();
Unfortunately, it requires you to get a Google SOAP API Key, which Google no longer supports.
Perhaps the author, Darren Chamberlain, will consider upgrading DBD::Google to use REST::Google or something similar instead.
Here's to hoping :-)
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment