NAME
Shipment::Address
VERSION
version 3.10
SYNOPSIS
use Shipment::Address;
my $address = Shipment::Address->new(
name => 'Foo Bar',
address1 => '123 Any Street NW',
city => 'Calgary',
province => 'Alberta',
postal_code => 'T1A1A1',
country => 'Canada',
phone => '12345678',
);
print $address->province_code . "\n"; ## AB
print $address->country_code . "\n"; ## CA
print $address->address_components->{direction} . "\n"; ## NW
print $address->phone_components->{area} . "\n"; ## 234
NAME
Shipment::Address - a shipping address
ABOUT
This class defines a shipping address and provides some methods for parsing the address
Class Attributes
name
The contact name
type: String
alias: contact
company
The company name
type: String
default: n/a
address_type
Whether the address is residential or business
address1, address2, address3
The street address lines
type: String
city
The city name
type: String
alias: town
province
The state/province name or code. Whether a name or code is given, the province_code attribute can be used to obtain the code.
type: String
alias: state
province_code
READONLY access to the province code based on the province attribute.
postal_code
The postal code/zip
type: String
alias: zip
country
The country name/code. Whether a name or code is given, the country_code attribute can be used to obtain the code
type: String
country_code
READONLY access to the country code based on the country attribute
address_components
READONLY access to the address components (street, direction, number)
phone
The phone number. The following regex is used to parse out the country code, area code, and phone part:
($country, $junk, $area, $junk, $phone) = ($self->phone =~/^([0-9]( |-)?)?(\(?[0-9]{3}\)?|[0-9]{3})( |-)?([0-9]{3}( |-)?[0-9]{4}|[a-zA-Z0-9]{7})$/);
type: String
phone_components
READONLY access to the phone components (country, area, phone)
The email address
type: String
AUTHOR
Andrew Baerg @ <andrew at pullingshots dot ca>
http://pullingshots.ca/
BUGS
Issues can be submitted at https://github.com/pullingshots/Shipment/issues
COPYRIGHT
Copyright (C) 2016 Andrew J Baerg, All Rights Reserved
NO WARRANTY
Absolutely, positively NO WARRANTY, neither express or implied, is offered with this software. You use this software at your own risk. In case of loss, no person or entity owes you anything whatsoever. You have been warned.
LICENSE
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
AUTHOR
Andrew Baerg <baergaj@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2018 by Andrew Baerg.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.