| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | =encoding utf-8 | 
| 2 |  |  |  |  |  |  |  | 
| 3 |  |  |  |  |  |  | =head1 NAME | 
| 4 |  |  |  |  |  |  |  | 
| 5 |  |  |  |  |  |  | Business::cXML::Address::Postal - cXML postal address | 
| 6 |  |  |  |  |  |  |  | 
| 7 |  |  |  |  |  |  | =head1 SYNOPSIS | 
| 8 |  |  |  |  |  |  |  | 
| 9 |  |  |  |  |  |  | use Business::cXML::Address::Postal; | 
| 10 |  |  |  |  |  |  |  | 
| 11 |  |  |  |  |  |  | =head1 DESCRIPTION | 
| 12 |  |  |  |  |  |  |  | 
| 13 |  |  |  |  |  |  | Object representation of a cXML C<PostalAddress>. | 
| 14 |  |  |  |  |  |  |  | 
| 15 |  |  |  |  |  |  | =head1 METHODS | 
| 16 |  |  |  |  |  |  |  | 
| 17 |  |  |  |  |  |  | See L<Business::cXML::Object/COMMON METHODS>. | 
| 18 |  |  |  |  |  |  |  | 
| 19 |  |  |  |  |  |  | =head1 PROPERTY METHODS | 
| 20 |  |  |  |  |  |  |  | 
| 21 |  |  |  |  |  |  | See L<Business::cXML::Object/PROPERTY METHODS> for how the following operate. | 
| 22 |  |  |  |  |  |  |  | 
| 23 |  |  |  |  |  |  | =over | 
| 24 |  |  |  |  |  |  |  | 
| 25 |  |  |  |  |  |  | =cut | 
| 26 |  |  |  |  |  |  |  | 
| 27 | 10 |  |  | 10 |  | 207 | use 5.014; | 
|  | 10 |  |  |  |  | 29 |  | 
| 28 | 10 |  |  | 10 |  | 60 | use strict; | 
|  | 10 |  |  |  |  | 21 |  | 
|  | 10 |  |  |  |  | 320 |  | 
| 29 |  |  |  |  |  |  |  | 
| 30 |  |  |  |  |  |  | use base qw(Business::cXML::Object); | 
| 31 | 10 |  |  | 10 |  | 75 |  | 
|  | 10 |  |  |  |  | 26 |  | 
|  | 10 |  |  |  |  | 791 |  | 
| 32 |  |  |  |  |  |  | use constant NODENAME => 'PostalAddress'; | 
| 33 | 10 |  |  | 10 |  | 65 | use constant PROPERTIES => ( | 
|  | 10 |  |  |  |  | 18 |  | 
|  | 10 |  |  |  |  | 917 |  | 
| 34 | 10 |  |  |  |  | 635 | name        => undef, | 
| 35 |  |  |  |  |  |  | delivertos  => [], | 
| 36 |  |  |  |  |  |  | streets     => [], | 
| 37 |  |  |  |  |  |  | city        => '', | 
| 38 |  |  |  |  |  |  | muni        => undef, | 
| 39 |  |  |  |  |  |  | state       => undef, | 
| 40 |  |  |  |  |  |  | code        => undef, | 
| 41 |  |  |  |  |  |  | country_iso => '', | 
| 42 |  |  |  |  |  |  | country     => '', | 
| 43 |  |  |  |  |  |  | ); | 
| 44 | 10 |  |  | 10 |  | 64 |  | 
|  | 10 |  |  |  |  | 18 |  | 
| 45 |  |  |  |  |  |  | use XML::LibXML::Ferry; | 
| 46 | 10 |  |  | 10 |  | 65 |  | 
|  | 10 |  |  |  |  | 26 |  | 
|  | 10 |  |  |  |  | 2446 |  | 
| 47 |  |  |  |  |  |  | my ($self, $el) = @_; | 
| 48 |  |  |  |  |  |  |  | 
| 49 | 15 |  |  | 15 | 1 | 46 | $el->ferry($self, { | 
| 50 |  |  |  |  |  |  | Municipality => 'muni', | 
| 51 | 15 |  |  |  |  | 117 | PostalCode   => 'code', | 
| 52 |  |  |  |  |  |  | Country      => { | 
| 53 |  |  |  |  |  |  | isoCountryCode => 'country_iso', | 
| 54 |  |  |  |  |  |  | __text         => 'country', | 
| 55 |  |  |  |  |  |  | }, | 
| 56 |  |  |  |  |  |  | } | 
| 57 |  |  |  |  |  |  | ); | 
| 58 |  |  |  |  |  |  | } | 
| 59 |  |  |  |  |  |  |  | 
| 60 |  |  |  |  |  |  | my ($self, $doc) = @_; | 
| 61 |  |  |  |  |  |  | my $node = $doc->create($self->{_nodeName}); | 
| 62 |  |  |  |  |  |  | $node->{name} = $self->{name} if $self->{name}; | 
| 63 | 8 |  |  | 8 | 1 | 25 |  | 
| 64 | 8 |  |  |  |  | 28 | $node->add('DeliverTo', $_) foreach (@{ $self->{delivertos} }); | 
| 65 | 8 | 100 |  |  |  | 114 | $node->add('Street', $_) foreach (@{ $self->{streets} }); | 
| 66 |  |  |  |  |  |  | $node->add('Street', ' ') unless scalar(@{ $self->{streets} });  # At least one required | 
| 67 | 8 |  |  |  |  | 338 | $node->add('City', $self->{city}); | 
|  | 8 |  |  |  |  | 55 |  | 
| 68 | 8 |  |  |  |  | 300 | $node->add('Municipality', $self->{muni}) if $self->{muni}; | 
|  | 8 |  |  |  |  | 40 |  | 
| 69 | 8 | 100 |  |  |  | 238 | $node->add('State', $self->{state}) if $self->{state}; | 
|  | 8 |  |  |  |  | 35 |  | 
| 70 | 8 |  |  |  |  | 60 | $node->add('PostalCode', $self->{code}) if $self->{code}; | 
| 71 | 8 | 100 |  |  |  | 340 | $node->add('Country', $self->{country}, isoCountryCode => $self->{country_iso}); | 
| 72 | 8 | 100 |  |  |  | 303 | return $node; | 
| 73 | 8 | 100 |  |  |  | 258 | } | 
| 74 | 8 |  |  |  |  | 240 |  | 
| 75 | 8 |  |  |  |  | 423 | =item C<B<name>> | 
| 76 |  |  |  |  |  |  |  | 
| 77 |  |  |  |  |  |  | Optional, name of this address (i.e. C<billing department>) | 
| 78 |  |  |  |  |  |  |  | 
| 79 |  |  |  |  |  |  | =item C<B<delivertos>[]> | 
| 80 |  |  |  |  |  |  |  | 
| 81 |  |  |  |  |  |  | Optional | 
| 82 |  |  |  |  |  |  |  | 
| 83 |  |  |  |  |  |  | =item C<B<streets>[]> | 
| 84 |  |  |  |  |  |  |  | 
| 85 |  |  |  |  |  |  | Mandatory (at least one) | 
| 86 |  |  |  |  |  |  |  | 
| 87 |  |  |  |  |  |  | =item C<B<city>> | 
| 88 |  |  |  |  |  |  |  | 
| 89 |  |  |  |  |  |  | Mandatory | 
| 90 |  |  |  |  |  |  |  | 
| 91 |  |  |  |  |  |  | =item C<B<muni>> | 
| 92 |  |  |  |  |  |  |  | 
| 93 |  |  |  |  |  |  | Optional | 
| 94 |  |  |  |  |  |  |  | 
| 95 |  |  |  |  |  |  | =item C<B<state>> | 
| 96 |  |  |  |  |  |  |  | 
| 97 |  |  |  |  |  |  | Optional | 
| 98 |  |  |  |  |  |  |  | 
| 99 |  |  |  |  |  |  | =item C<B<code>> | 
| 100 |  |  |  |  |  |  |  | 
| 101 |  |  |  |  |  |  | Optional postal code | 
| 102 |  |  |  |  |  |  |  | 
| 103 |  |  |  |  |  |  | =item C<B<country_iso>> | 
| 104 |  |  |  |  |  |  |  | 
| 105 |  |  |  |  |  |  | Mandatory 2-letter ISO country code | 
| 106 |  |  |  |  |  |  |  | 
| 107 |  |  |  |  |  |  | =item C<B<country>> | 
| 108 |  |  |  |  |  |  |  | 
| 109 |  |  |  |  |  |  | Mandatory | 
| 110 |  |  |  |  |  |  |  | 
| 111 |  |  |  |  |  |  | =back | 
| 112 |  |  |  |  |  |  |  | 
| 113 |  |  |  |  |  |  | =head1 AUTHOR | 
| 114 |  |  |  |  |  |  |  | 
| 115 |  |  |  |  |  |  | Stéphane Lavergne L<https://github.com/vphantom> | 
| 116 |  |  |  |  |  |  |  | 
| 117 |  |  |  |  |  |  | =head1 ACKNOWLEDGEMENTS | 
| 118 |  |  |  |  |  |  |  | 
| 119 |  |  |  |  |  |  | Graph X Design Inc. L<https://www.gxd.ca/> sponsored this project. | 
| 120 |  |  |  |  |  |  |  | 
| 121 |  |  |  |  |  |  | =head1 COPYRIGHT & LICENSE | 
| 122 |  |  |  |  |  |  |  | 
| 123 |  |  |  |  |  |  | Copyright (c) 2017-2018 Stéphane Lavergne L<https://github.com/vphantom> | 
| 124 |  |  |  |  |  |  |  | 
| 125 |  |  |  |  |  |  | Permission is hereby granted, free of charge, to any person obtaining a copy | 
| 126 |  |  |  |  |  |  | of this software and associated documentation files (the "Software"), to deal | 
| 127 |  |  |  |  |  |  | in the Software without restriction, including without limitation the rights | 
| 128 |  |  |  |  |  |  | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | 
| 129 |  |  |  |  |  |  | copies of the Software, and to permit persons to whom the Software is | 
| 130 |  |  |  |  |  |  | furnished to do so, subject to the following conditions: | 
| 131 |  |  |  |  |  |  |  | 
| 132 |  |  |  |  |  |  | The above copyright notice and this permission notice shall be included in all | 
| 133 |  |  |  |  |  |  | copies or substantial portions of the Software. | 
| 134 |  |  |  |  |  |  |  | 
| 135 |  |  |  |  |  |  | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | 
| 136 |  |  |  |  |  |  | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 
| 137 |  |  |  |  |  |  | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | 
| 138 |  |  |  |  |  |  | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | 
| 139 |  |  |  |  |  |  | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | 
| 140 |  |  |  |  |  |  | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | 
| 141 |  |  |  |  |  |  | SOFTWARE. | 
| 142 |  |  |  |  |  |  |  | 
| 143 |  |  |  |  |  |  | =cut | 
| 144 |  |  |  |  |  |  |  | 
| 145 |  |  |  |  |  |  | 1; |