File Coverage

blib/lib/XML/SRS/Contact/PSTN.pm
Criterion Covered Total %
statement 2 4 50.0
branch n/a
condition n/a
subroutine 2 2 100.0
pod n/a
total 4 6 66.6


line stmt bran cond sub pod time code
1              
2             package XML::SRS::Contact::PSTN;
3             BEGIN {
4 1     1   1684 $XML::SRS::Contact::PSTN::VERSION = '0.09';
5             }
6              
7 1     1   425 use Moose;
  0            
  0            
8             use PRANG::Graph;
9              
10             has_attr 'cc' =>
11             is => "ro",
12             isa => "Str",
13             xml_name => "CountryCode",
14             xml_required => 0,
15             ;
16              
17             has_attr 'ndc' =>
18             is => "ro",
19             isa => "Str",
20             xml_name => "AreaCode",
21             xml_required => 0,
22             ;
23              
24             has_attr 'subscriber' =>
25             is => "ro",
26             isa => "Str",
27             xml_name => "LocalNumber",
28             xml_required => 0,
29             ;
30              
31             with 'XML::SRS::Node';
32              
33             use Moose::Util::TypeConstraints;
34             coerce __PACKAGE__
35             => from "HashRef"
36             => via { __PACKAGE__->new(%$_); };
37              
38             # a coerce from Str will only handle strings in the format
39             # defined in the EPP specification ()
40             coerce __PACKAGE__
41             => from "Str"
42             => via {
43             $_ =~ m/^\+(\d{1,3})\.(\d+)$/;
44             __PACKAGE__->new(cc=>$1,ndc=>'',subscriber=>$2);
45             };
46              
47             coerce __PACKAGE__
48             => from "Undef"
49             => via { __PACKAGE__->new() };
50              
51             1;
52              
53             __END__
54              
55             =head1 NAME
56              
57             XML::SRS::Contact::PSTN - Class representing an SRS Phone Number object
58              
59             =head1 DESCRIPTION
60              
61             This class represents an SRS Phone number object.
62              
63             =head1 ATTRIBUTES
64              
65             Each attribute of this class has an accessor/mutator of the same name as
66             the attribute. Additionally, they can be passed as parameters to the
67             constructor.
68              
69             =head2 subscriber
70              
71             Must be of type Str. Maps to the XML attribute 'LocalNumber'
72              
73             =head2 ndc
74              
75             Must be of type Str. Maps to the XML attribute 'AreaCode'
76              
77             =head2 cc
78              
79             Must be of type Str. Maps to the XML attribute 'CountryCode'
80              
81             =head1 METHODS
82              
83             =head2 new(%params)
84              
85             Construct a new XML::SRS::Request object. %params specifies the initial
86             values of the attributes.
87              
88             =head1 COMPOSED OF
89              
90             L<XML::SRS::Node>