Busine...zation(3pm)

πŸ“¦
version 1.125 Β· 3 versions
, in ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– Business::US::USPS::WebTools::AddressStandardization β€” canonicalize a US address πŸ’–

okay bestie, so this little page is Business::US::USPS::WebTools::AddressStandardization(3pm), part of the User Contributed Perl Documentation, and it's here to make US addresses look ✨correct✨.


🌸 NAME 🌸

Business::US::USPS::WebTools::AddressStandardization β€” canonicalize a US address. that's it, that's the whole job, and it eats 🫢


✨ SYNOPSIS ✨

here's the vibe, no cap:

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

my $verifier = Business::US::USPS::WebTools::AddressStandardization->new( {
    UserID   => $ENV{USPS_WEBTOOLS_USERID},
    Password => $ENV{USPS_WEBTOOLS_PASSWORD},
    Testing  => 1,
    } );

my $hash = $verifier->verify_address(
    FirmName => '',
    Address1 => '',
    Address2 => '6406 Ivy Lane',
    City     => 'Greenbelt',
    State    => 'MD',
    Zip5     => '',
    Zip4     => '',
    );

if( $verifier->is_error )
    {
    warn "Oh No! $verifier->{error}{description}\n";
    }
else
    {
    print join "\n", map { "$_: $hash->{$_}" }
        qw(FirmName Address1 Address2 City State Zip5 Zip4 DeliveryPoint CarrierRoute ReturnText);
    }

like… you build the thing, you hand it an address, you check if it errored, and if not you print the glow-up version. iconic behavior honestly πŸ’…


πŸ’œ DESCRIPTION πŸ’œ

* THIS IS ALPHA SOFTWARE *

okay first things first, huge disclaimer energy: this is alpha software, so treat it like a friend who's almost done getting ready. πŸ’€

So this module implements the Address Standardization web service from the US Postal Service. It's a subclass of Business::US::USPS::WebTools, meaning it inherits all the base-class behavior and just adds the address-verification glow-up on top. 🌈

πŸŽ€ verify_address( KEY, VALUE, ... )

The verify_address method takes the following keys β€” and these come directly from the USPS web service interface, so no funny business, we keep them exactly as-is:

FirmName    The name of the company
Address1    The suite or apartment
Address2    The street address
City        The name of the city
State        The two letter state abbreviation
Zip5        The 5 digit ZIP code
Zip4        The 4 digit extension to the ZIP code

It returns an anonymous hash with the same keys, but the values are now the USPS's canonicalized address β€” plus three bonus keys because we love a little extra:

DeliveryPoint    The 2 digit extension to the ZIP+4 code
CarrierRoute    The 4 character postal carrier route
ReturnText    An error message when multiple addresses are found

now if something goes wrong? the hash values will be the empty string, and the error flag is set. check on it with is_error:

$verifier->is_error;

and for the full tea on error information, go read the is_error documentation over in Business::US::USPS::WebTools. it's all there, fr fr.


πŸ‘€ TO DO πŸ‘€

...nothing here bestie, this section is literally empty. the to-do list is a blank notebook. we support that. πŸ“


πŸ”₯ SEE ALSO πŸ”₯

  • Business::US::USPS::WebTools

The WebTools API is documented on the US Postal Service's website:

https://www.usps.com/business/web-tools-apis/address-information-api.pdf

πŸ¦‹ SOURCE AVAILABILITY πŸ¦‹

This source is in GitHub:

https://github.com/ssimms/business-us-usps-webtools

go clone it, go read it, go slay πŸ’–


πŸ‘‘ AUTHOR πŸ‘‘

brian d foy


🧚 MAINTAINER 🧚

Steve Simms


Copyright Β© 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.


and that's the whole page, bestie ✨ this was perl v5.36.0 energy, dated 2022-08-28, straight out of the Busine...zation(3pm) corner of the docs. stay canonicalized πŸ’–πŸ«ΆπŸŒΈ

πŸ“¦ where this page comes from