SYNOPSIS

        use Business::US::USPS::WebTools;

        # see subclasses for API details

DESCRIPTION

*** \s-1THIS\s0 \s-1IS\s0 \s-1ALPHA\s0 \s-1SOFTWARE\s0 ***

This is the base class for the WebTools web service from the \s-1US\s0 Postal Service. The \s-1USPS\s0 offers several services, and this module handles the parts common to all of them: making the request, getting the response, parsing error reponses, and so on. The interesting stuff happens in one of the subclasses which implement a particular service. So far, the only subclass in this distribution is \*(C`Business::US::USPS::WebTools::AddressVerification\*(C'.

new( \s-1ANONYMOUS_HASH\s0 )

Make the web service object. Pass is an anonymous hash with these keys: UserID the user id provided by the USPS Password the password provided by the USPS Testing true or false, to select the right server If you don't pass the UserID or Password entries, \*(C`new\*(C' looks in the environment variables \s-1USPS_WEBTOOLS_USERID\s0 and \s-1USPS_WEBTOOLS_PASSWORD\s0. If \*(C`new\*(C' cannot find both the User \s-1ID\s0 and the Password, it croaks. If you pass a true value with the Testing key, the object will use the testing server host name and the testing \s-1URL\s0 path. If the Testing key is false or not present, the object uses the live server details.

userid

Returns the User \s-1ID\s0 for the web service. You need to get this from the \s-1US\s0 Postal Service.

password

Returns the Password for the web service. You need to get this from the \s-1US\s0 Postal Service.

url

Returns the \s-1URL\s0 for the request to the web service. So far, all requests are \s-1GET\s0 request with all of the data in the query string.

response

Returns the response from the web service. This is the slightly modified response. So far it only fixes up line endings and normalizes some error output for inconsistent responses from different physical servers.

is_error

Returns true if the response to the last request was an error, and false otherwise. If the response was an error, this method sets various fields in the object: $self->{error}{number} $self->{error}{source} $self->{error}{description} $self->{error}{help_file} $self->{error}{help_context}

RELATED TO Business::US::USPS::WebTools…

The WebTools \s-1API\s0 is documented on the \s-1US\s0 Postal Service's website:

http://www.usps.com/webtools/htm/Address-Information.htm

SOURCE AVAILABILITY

This source is part of a SourceForge project which always has the latest sources in \s-1CVS\s0, as well as all of the previous releases.

http://sourceforge.net/projects/brian-d-foy/

If, for some reason, I disappear from the world, one of the other members of the project can shepherd this module appropriately.

AUTHOR

brian d foy, \*(C`<[email protected]>\*(C'

COPYRIGHT AND LICENSE

Copyright (c) 2006-2007 brian d foy. All rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.