XML::Parser::YahooRESTGeocodeXML::Parser::YahooRESTGeocode is an XML::Parser subclass for parsing results returned from YAHOO REST geocode webservice. | |
Download |
XML::Parser::YahooRESTGeocode Ranking & Summary
Advertisement
- License:
- Perl Artistic License
- Price:
- FREE
- Publisher Name:
- Andrew N. Hicox
- Publisher web site:
- http://search.cpan.org/~ahicox/Config-Framework-2.5/Framework.pod
XML::Parser::YahooRESTGeocode Tags
XML::Parser::YahooRESTGeocode Description
XML::Parser::YahooRESTGeocode is an XML::Parser subclass for parsing results returned from YAHOO REST geocode webservice. SYNOPPSIS use LWP::Simple use XML::Parser; use XML::Parser::YahooRESTGeocode; #connect to yahoo geocode service my $url = 'http://api.local.yahoo.com/MapsService/V1/geocode'; my $get = 'appid=YahooDemo&street=701+First+Street&city=Sunnyvale&state=CA'; #call yahoo geocode service my $xml = get $url . "?" . $get; #construct use XML::Parser with YahooRESTGeocode subclass my $parser = new XML::Parser(Style => 'YahooRESTGeocode'); my $data = $parser->parse($xml) || do { die ("parse failed: $XML::Parser::errstr, $!n"); }; #use the data for something my $cnt = 0; foreach my $result (@{$data->{'Result'}}){ $cnt ++; print "n---- RESULT #" . $cnt . " ----n"; foreach my $field (keys %{$result}){ print "t: " . $result->{$field} . "n"; } }NOTESworks for geocode onlythis module only knows how to handle Yahoo!'s REST responses from the geocode APIknown fields this module will need to be modified if more fields are added to the node, namely, their names will need to be added to the %node_tree hash at the top of the modulethis was a quick hack hey, maybe there's a better module for parsing REST query responses out there? This module was written as a quick hack, not as a one stop solution. If you want to add improvements or what have you, then please feel free to hack away on this 'till you're blue in the face. Send me the changes though, so I can put 'em in the distribution.'make test' dosen't really test anything well ... it's a quick hack. part of writing a quick hack is not writing proper test cases and skimping on documentation, speaking of ... why am I still writing ???thanks to Yahoo! Hey, Yahoo! Thanks for your geocode API, it's pretty sweet!Requirements:· Perl Requirements: · Perl
XML::Parser::YahooRESTGeocode Related Software