Busine...bTools(3pm)
π NAME
Business::US::USPS::WebTools β your lil gateway to the US Postal Service Web Tools, bestie π
β¨ SYNOPSIS β¨
use Business::US::USPS::WebTools;
# see subclasses for API details
That's literally it for the base class β the real tea is in the subclasses, iykyk π«
πΈ DESCRIPTION πΈ
*** THIS IS ALPHA SOFTWARE *** π no cap, it said it, not me
So here's the vibe: this is the base class for the WebTools web service from the US Postal Service π The USPS offers a whole bunch of services, and this module handles all the stuff they have in common β making the request, getting the response back, parsing error responses, all that plumbing π° The actually interesting stuff happens in one of the subclasses, which implement a particular service. So far, the only subclass in this distribution is Business::US::USPS::WebTools::AddressStandardization π
π¦ Methods (the whole roster)
new( ANONYMOUS_HASH )β makes the web service object, periodt π You pass in 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, new goes looking in the environment variables USPS_WEBTOOLS_USERID and USPS_WEBTOOLS_PASSWORD π
And if new still can't find both the User ID and the Password? It croaks π fr fr, it just dies right there.
If you pass a true value with the Testing key, the object will use the testing server host name and the testing URL path π§ͺ If the Testing key is false or just not present at all, the object uses the live server details π₯ (yes, real postal service, main character energy)
useridβ returns the User ID for the web service πͺͺ You gotta get this one from the US Postal Service yourself, bestie, I can't manifest it for you.passwordβ returns the Password for the web service π Also a you-get-it-from-the-USPS situation, sorry babe.urlβ returns the URL for the request to the web service π So far, every single request is a GET request with all of the data shoved into the query string. That's the whole thing.txβ returns the transaction from theMojo::UserAgentrequest π¬responseβ returns the response from the web service π It's the slightly modified response β so far it only fixes up line endings and normalizes some error output, because the different physical servers are inconsistent and honestly, same π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}
live_server_hostβ this isproduction.shippingapis.comπ The modules choose this host when you have not setTestingto a true value.test_server_hostβ for most APIs, this istesting.shippingapis.comπ§ͺ The modules choose this host when you have setTestingto a true value.
π SEE ALSO
The WebTools API is documented on the US Postal Service's website:
http://www.usps.com/webtools/htm/Address-Information.htm
Go read the source of truth, bestie π
π SOURCE AVAILABILITY
This source is in GitHub:
https://github.com/ssimms/business-us-usps-webtools
π AUTHOR
brian d foy
π MAINTAINER
Steve Simms
π COPYRIGHT AND LICENSE
Copyright Β© 2020, Steve Simms. All rights reserved.
This program is free software; you can redistribute it and/or modify it under the terms of the Artistic License 2.0.
okay that's the whole page, slay π
this was documented under perl v5.36.0, dated 2022-08-28, and it lives in the User Contributed Perl Documentation manual β Busine...bTools(3pm), yes the title got truncated by the manpage formatter and no, we are not fixing it, it's iconic πβ¨
π¦ where this page comes from
- ubuntu noble: libbusiness-us-usps-webtools-perl 1.125-2 Β· Artistic-2.0
- ubuntu resolute: libbusiness-us-usps-webtools-perl 1.125-2 Β· Artistic-2.0
- ubuntu stonking: libbusiness-us-usps-webtools-perl 1.125-2 Β· Artistic-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms