NAME
Net::RDAP::JCard::Address - a module representing a postal address in a Net::RDAP::JCard object.
SYNOPSIS
#
# get an object by calling the jcard() method on a Net::RDAP::Object::Entity
#
my $jcard = $entity->jcard;
#
# get the first address. You can also uses $jcard->addresses() to get all
# ADR properties.
#
my $adr = $jcard->first_address;
if ($adr->structured) {
#
# This is a structured address so we can extract the individual components:
#
map { say "Street: ".$_ } @{$adr->street};
say "Locality: ".$adr->locality;
say "Region: ".$adr->region;
say "Postal Code: ".$adr->code;
say "Country: ".($adr->cc || $adr->country);
} else {
#
# This is an unstructured address, so just print it:
#
say "Address:".$adr->address;
}
DESCRIPTION
The vCard and jCard representations of postal address data can be quite difficult to deal with, and often cause difficulties.
Net::RDAP::JCard::Address provides an ergonomic interface to ADR
properties in jCard objects.
To get a Net::RDAP::JCard::Address, use the first_address()
or addresses()
methods of Net::RDAP::JCard to get an array of address objects.
METHODS
Net::RDAP::JCard::Address inherits from Net::RDAP::JCard::Property, and therefore inherits all that module's methods, in addition to the following:
ADDRESS TYPE
$structured = $adr->structured;
Returns true if the address is "structured" (see Section 3.3.1.3 of RFC 7095).
FLAT ADDRESS
say $adr->address;
Returns a multi-line text string containing the address. For "unstructured" addresses, this is the only format available, and is therefore the simplest way to display the address information.
P.O. BOX NUMBER
say $adr->pobox;
Returns the Post Office box number, or undef
.
EXTENDED ADDRESS
say $adr->extended;
Returns the "extended" address component, such as the apartment or suite number, or undef
.
STREET ADDRESS
map { say $_ } @{$adr->street};
Some structured addresses have a single street address, but some have multiple street addresses which are represented as an arrayref.
This method will always return an arrayref, which may contain zero, one, or many values.
LOCALITY
say $adr->locality;
Returns the locality, or undef
.
REGION
say $adr->region;
Returns the region, or undef
.
POSTAL CODE
say $adr->code;
Returns the postal code, or undef
.
COUNTRY CODE
say $adr->cc;
Returns the ISO-3166-alpha2 country code (see Section 3.1 of RFC 8605), or undef
.
COUNTRY NAME
say $adr->country;
Returns the country name, or undef
.
COPYRIGHT
Copyright 2018-2023 CentralNic Ltd, 2024 Gavin Brown. For licensing information, please see the LICENSE
file in the Net::RDAP distribution.