Shipment::Address
version 2.03
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
Shipment::Address - a shipping address
This class defines a shipping address and provides some methods for parsing the address
The contact name
type: String
alias: contact
The company name
default: n/a
Whether the address is residential or business
The street address lines
The city name
alias: town
The state/province name or code. Whether a name or code is given, the province_code attribute can be used to obtain the code.
alias: state
READONLY access to the province code based on the province attribute.
The postal code/zip
alias: zip
The country name/code. Whether a name or code is given, the country_code attribute can be used to obtain the code
READONLY access to the country code based on the country attribute
READONLY access to the address components (street, direction, number)
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})$/);
READONLY access to the phone components (country, area, phone)
The email address
Andrew Baerg @ <andrew at pullingshots dot ca>
http://pullingshots.ca/
Issues can be submitted at https://github.com/pullingshots/Shipment/issues
Copyright (C) 2016 Andrew J Baerg, All Rights Reserved
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.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Andrew Baerg <baergaj@cpan.org>
This software is copyright (c) 2016 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.
To install Shipment, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Shipment
CPAN shell
perl -MCPAN -e shell install Shipment
For more information on module installation, please visit the detailed CPAN module installation guide.