| 1 | |||
| 2 | package XML::SRS::Contact::PSTN; | ||
| 3 | 1 | ▶ | BEGIN { |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 1 | $XML::SRS::Contact::PSTN::VERSION = '0.09'; | |
| 5 | } | ||
| 6 | |||
| 7 | 1 | ▶ | use Moose; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 8 | 1 | ▶ | use PRANG::Graph; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 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 | 1 | ▶ | use Moose::Util::TypeConstraints; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 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__ | ||