Net-Google with ActiveState Perl
If you want to use the Google APIs via Perl, a search at CPAN wile lead you to
Net-Google. However, this distribution seems not to be available for the Active
State version of Perl last time I checked (March, 30th, 2004).
You want your ad served 320,000 times a month? Advertise on John Bokma dot com
and I make it happen.
Luckily, downloading the gzipped tar file and installing it is quite
straightforward. But first you need to get a license key from Google.
Getting a Google APIs license key
A license key is required from Google in order to use the Net-Google modules.
Visit the Google Web APIs site and download the developer's kit. This
kit contains useful documentation. Next, create a Google Account to obtain your
license key. This key makes it possible to do 1,000 automated queries per day.
After creating the account and confirming it by activating a link you get by
email you can request your license key. This key is also send by email. You
need this key in the modules build step below and, of course, for using
Net-Google in your own Perl programs.
Downloading Net-Google
Select Net-Google from the CPAN search: net-google search result. Click on the
link and select the download link from the resulting Net-Google page. This
should download a gzipped tar file. When finished downloading, extract the
gzipped tar file with, for example, 7-Zip.
Building the Perl modules
In order to build and install the Net-Google modules you need NMake.
See Make for Windows: NMake for more information on how to obtain
NMake.
The following lines are a copy of an installation on a Windows XP system. You
need to enter the license key in the NMake test step below.
Note: the latest version of Net-Google available at CPAN has a bug, see: Net::Google bug: missing wsdl file
for a quick and easy fix.
perl Makefile.PL
Checking if your kit is complete...
Looks good
Writing Makefile for Net::Google
nmake
Microsoft (R) Program Maintenance Utility Version 1.50
Copyright (c) Microsoft Corp 1988-94. All rights reserved.
cp lib/Net/Google/Search.pm blib\lib\Net\Google\Search.pm
cp lib/Net/Google.pm blib\lib\Net\Google.pm
cp lib/Net/Google/tool.pm blib\lib\Net\Google\tool.pm
cp lib/Net/Google/Spelling.pm blib\lib\Net\Google\Spelling.pm
cp lib/Net/Google/Cache.pm blib\lib\Net\Google\Cache.pm
cp lib/Net/Google/Services/GoogleSearch.wsdl blib\lib\Net\Google
\Services\GoogleSearch.wsdl
cp lib/Net/Google/Service.pm blib\lib\Net\Google\Service.pm
cp lib/Net/Google/Response.pm blib\lib\Net\Google\Response.pm
nmake test
Microsoft (R) Program Maintenance Utility Version 1.50
Copyright (c) Microsoft Corp 1988-94. All rights reserved.
C:\Perl\bin\perl.exe "-MExtUtils::Command::MM" "-e" "tes
t_harness(0, 'blib\lib', 'blib\arch')" t\000-key.t t\001-search.
t t\002-spelling.t t\003-cache.t t\000-key.........#
# The Google API web service requires that you provide create a
Google Account and obtain a license key
# This key is then passed with each request you make to the Goog
le servers.
# If you do not already have a Google Account, you can sign up f
or one here:
# http://www.google.com/apis/
#
# Please enter your Google API key:
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
t\000-key.........ok
t\001-search......ok
t\002-spelling....ok
t\003-cache.......ok
All tests successful.
Files=4, Tests=18, 103 wallclock secs ( 0.00 cusr + 0.00 csys =
0.00 CPU)
nmake install
Microsoft (R) Program Maintenance Utility Version 1.50
Copyright (c) Microsoft Corp 1988-94. All rights reserved.
Installing C:\Perl\site\lib\Net\Google.pm
Installing C:\Perl\site\lib\Net\Google\Cache.pm
Installing C:\Perl\site\lib\Net\Google\Response.pm
Installing C:\Perl\site\lib\Net\Google\Search.pm
Installing C:\Perl\site\lib\Net\Google\Service.pm
Installing C:\Perl\site\lib\Net\Google\Spelling.pm
Installing C:\Perl\site\lib\Net\Google\tool.pm
Installing C:\Perl\site\lib\Net\Google\Services\GoogleSearch.wsd
l
Appending installation info to C:\Perl\lib/perllocal.pod
A version of Perl for Microsoft Windows (Win32) operating systems, named ActivePerl, can be
downloaded from the ActiveState website.
Failed test 5
Recently, test 5 fails. This has been reported as a bug, see:
Comments: Net-Google with ActiveState Perl
Related links