We don't bite newbies here... much | |
PerlMonks |
Re^7: How to make Geo::Coder::Google run even if input location doesn't existby AnomalousMonk (Archbishop) |
on Mar 01, 2013 at 17:14 UTC ( [id://1021302]=note: print w/replies, xml ) | Need Help?? |
Whoa. I just took a look at the broader picture, and this chunk of code seems highly suspect. First off, let me say that I'm completely unfamiliar with Geo::Coder::Google and the Google service(s) involved, but one should never let compete ignorance prevent one from offering advice. The primary problem I see is that the $@ eval error variable is being evaluated within the eval block! The docs for $@ say (emphases added): $EVAL_ERROR It may be that the geocode() method throws an exception (dies) and traps that exception, thus setting $@ to a meaningful value; again, I'm not familiar with this module. If this is not the case, the test of $@ in a given loop may actually be testing the value set on the previous iteration of the until loop; however, I don't know if eval() clears $@ to a non-error value at the start of its execution. Either of these possibilities (or perhaps some other) may explain why you are still getting latitude and longitude coordinates for places that do not exist, at least insofar as Google is aware, which does not seem to be helpful behavior for your program and, yes, does seem to be a problem! Perhaps see the discussion of Error Variables in perlvar, likewise eval.
In Section
Seekers of Perl Wisdom
|
|