[root@mycomputer html]# ls -lah /data/geocode/ca/geocode_ca.db
-rw-r--r-- 1 root root 60M May 23 18:04 /data/geocode/ca/geocode_ca.db
[root@mycomputer html]# cat /usr/lib/perl5/site_perl/5.8.8/geocode.pm
package geocode;
sub geocode {
# Designate the location of the geocoding database
$geocodes = "/data/geocode/ca/geocode_ca.db";
# Retrieve the address value passed into the function
my ($class,$address) = @_;
# Point to the geocoding database
Geo::Coder::US->set_db($geocodes);
# Retrieve coordinates from geocoding database
my ($coords) = Geo::Coder::US->geocode($address);
# Return the latitudinal and longitudinal coordinates
return $coords->{lat},$coords->{long};
}
return 1;
[root@mycomputer html]# cat geocodews.pl
#!/usr/bin/perl -w
use Geo::Coder::US;
use SOAP::Transport::HTTP;
require("geocode.pm");
SOAP::Transport::HTTP::CGI->dispatch_to('geocode')->handle;
[root@mycomputer html]# cat geocodeclient.pl
#!/usr/bin/perl -w
use SOAP::Lite;
$soap = SOAP::Lite
-> uri('http://localhost/geocode')
-> proxy('http://localhost/geocodews.pl');
$address = "900 Cherry Ave., San Bruno, CA";
my $result = $soap->call('geocode', $address);
my $latitude = $result->result;
my $longitude = $result->paramsout;
print "Latitude: ".$latitude."\n";
print "Longitude: ".$longitude."\n";