blib/lib/Geo/Address/Mail/UK.pm

filter: Statementstmt 100% 28 / 28 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 7 / 7 Podpod n/a totaltotal 100% 35 / 35 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
↑ Summary
1 package Geo::Address::Mail::UK;
2 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 2 ▶use MooseX::Storage;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 2 with qw(MooseX::Storage::Deferred);
7  
8 2 ▶use Moose::Util::TypeConstraints;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 2 extends 'Geo::Address::Mail';
11  
12 2 our $VERSION = '0.02';
13  
14 subtype 'Geo::Address::Mail::UKPostalCode',
15 => as 'Str',
16 13 ▶ => where {
Subroutine __ANON__: called CC=1 SCAR=0.0
17 13 $_ =~ /^([A-PR-UWYZ]([0-9]{1,2}|([A-HK-Y][0-9]|[A-HK-Y][0-9]([0-9]|[ABEHMNPRV-Y]))|[0-9][A-HJKS-UW])\ [0-9][ABD-HJLNP-UW-Z]{2}|(GIR\ 0AA)|(SAN\ TA1)|(BFPO\ (C\/O\ )?[0-9]{1,4})|((ASCN|BBND|[BFS]IQQ|PCRN|STHL|TDCU|TKCA)\ 1ZZ))$/;
18 2 };
19  
20 2 has '+postal_code' => (
21 isa => 'Geo::Address::Mail::UKPostalCode'
22 );
23  
24 2 has 'building' => (
25 is => 'rw',
26 isa => 'Str'
27 );
28  
29 2 has 'locality' => (
30 is => 'rw',
31 isa => 'Str'
32 );
33  
34 2 __PACKAGE__->meta->make_immutable;
35 2 ▶no Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
36 2 1;
37  
38 =head1 NAME
39  
40 Geo::Address::Mail::UK - A Mailing Address in the United Kingdom
41  
42 =head1 SYNOPSIS
43  
44 Geo::Address::Mail::UK is a subclass of L<Geo::Address::Mail> that provides
45 specific validation and attributes for mailing addresses located in the United
46 Kingdom.
47  
48 use Geo::Address::Mail::UK;
49  
50 my $add = Geo::Address::Mail::UK->new(
51 name => 'Sherlock Holmes',
52 street => '221b Baker St',
53 city => 'London',
54 postal_code => 'NW1 6XE'
55 );
56  
57 =head1 ATTRIBUTES
58  
59 Geo::Address::Mail::UK has all the attributes of L<Geo::Address::Mail>. The
60 following attributes are either modified or new.
61  
62 =head2 postal_code
63  
64 Postal codes are validated to conform to the Royal Mail standard.
65  
66 =head2 building
67  
68 Addresses can have a building name between the name and the street address.
69  
70 =head2 locality
71  
72 Addresses have an optional locality added between the street address and the
73 city name.
74  
75 =head1 AUTHOR
76  
77 Andrew Nelson, C<< <anelson at cpan.org> >>
78  
79 =head1 ACKNOWLEDGEMENTS
80  
81 =head1 COPYRIGHT & LICENSE
82  
83 This software is copyright (c) 2011 by Infinity Interactive, Inc..
84  
85 This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
86  
87 =cut
↑ Summary