A Perl interface to the US Postal Service Web Tools

brian_d_foy on 2006-09-16T08:54:51

I've written Business-USPS-WebTools to interact with the US Postal Service's Web Tools. This isn't screen scraping; it's a real web service officially offered by the USPS. SO far I've only done the Address Information services: Address Standardization, Zip Code Lookup, and City/State Lookup. I didn't use any of the XML modules or anything other yucky things. The requests and responses are very small, and the other side doesn't understand real XML anyway.

The kicker is that you need an account and it's a rather dodgy system for getting one. The USPS will initially give you a developer user id and a password, but it only works on their test system and only for very specific queries (all of which are test cases for these modules). After that, you have to somehow get ahold of the USPS Internet Customer Care Center to get the real server details. I'm not going to violate their terms of service by posting those details here (and they haven't made it into the module yet because I want to ensure it's doing everything right first).

You may notice that my implementation diverges a bit from the USPS docs. I went with what their servers actually did, not the cut-n-paste hack job they posted for developers. It took me about a half hour to convince myself that I was reading the right sections of the docs because they looked a lot like the previous sections. It turns out they were the previous sections doing overtime.

It's just hit PAUSE, so it might take a bit to get to CPAN. They are alpha right now, and there are some interface things I need to fix, but its a start. Eventually, i'll put this together with the mailing label modules to print nice, machine readable addresses for The Perl Review. :)