A good starting point would be the closest method in Geo::Distance.
In reply to Re: Calculating Distance by derby in thread Calculating Distance by jeffthewookiee