| 1 | |||
| 2 | package XML::EPP::Result; | ||
| 3 | |||
| 4 | 1 | ▶ | use Moose; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | 0 | ▶ | use MooseX::Method::Signatures; |
|
Subroutine
BEGIN: called CC=1 SCAR=2.6
| |||
| 6 | use Moose::Util::TypeConstraints; | ||
| 7 | use PRANG::Graph; | ||
| 8 | |||
| 9 | use XML::EPP::Error; | ||
| 10 | |||
| 11 | our $SCHEMA_PKG = "XML::EPP"; | ||
| 12 | our $PKG = __PACKAGE__; | ||
| 13 | |||
| 14 | # grep '^ *[0-9][0-9][0-9][0-9] *' rfc5730.txt | ||
| 15 | our %result_codes = map { m/^\s*(\d{4})\s+"(.*)"$/ } split /\n/, <<CODES; | ||
| 16 | 1000 "Command completed successfully" | ||
| 17 | 1001 "Command completed successfully; action pending" | ||
| 18 | 1300 "Command completed successfully; no messages" | ||
| 19 | 1301 "Command completed successfully; ack to dequeue" | ||
| 20 | 1500 "Command completed successfully; ending session" | ||
| 21 | 2000 "Unknown command" | ||
| 22 | 2001 "Command syntax error" | ||
| 23 | 2002 "Command use error" | ||
| 24 | 2003 "Required parameter missing" | ||
| 25 | 2004 "Parameter value range error" | ||
| 26 | 2005 "Parameter value syntax error" | ||
| 27 | 2100 "Unimplemented protocol version" | ||
| 28 | 2101 "Unimplemented command" | ||
| 29 | 2102 "Unimplemented option" | ||
| 30 | 2103 "Unimplemented extension" | ||
| 31 | 2104 "Billing failure" | ||
| 32 | 2105 "Object is not eligible for renewal" | ||
| 33 | 2106 "Object is not eligible for transfer" | ||
| 34 | 2200 "Authentication error" | ||
| 35 | 2201 "Authorization error" | ||
| 36 | 2202 "Invalid authorization information" | ||
| 37 | 2300 "Object pending transfer" | ||
| 38 | 2301 "Object not pending transfer" | ||
| 39 | 2302 "Object exists" | ||
| 40 | 2303 "Object does not exist" | ||
| 41 | 2304 "Object status prohibits operation" | ||
| 42 | 2305 "Object association prohibits operation" | ||
| 43 | 2306 "Parameter value policy error" | ||
| 44 | 2307 "Unimplemented object service" | ||
| 45 | 2308 "Data management policy violation" | ||
| 46 | 2400 "Command failed" | ||
| 47 | 2500 "Command failed; server closing connection" | ||
| 48 | 2501 "Authentication error; server closing connection" | ||
| 49 | 2502 "Session limit exceeded; server closing connection" | ||
| 50 | CODES | ||
| 51 | |||
| 52 | has_element 'msg' => | ||
| 53 | is => "rw", | ||
| 54 | isa => "${SCHEMA_PKG}::msgType", | ||
| 55 | coerce => 1, | ||
| 56 | required => 1, | ||
| 57 | lazy => 1, | ||
| 58 | default => sub { | ||
| 59 | my $self = shift; | ||
| 60 | $result_codes{$self->code}; | ||
| 61 | }, | ||
| 62 | ; | ||
| 63 | |||
| 64 | subtype "${PKG}::choice0" | ||
| 65 | => as join("|", map { "${SCHEMA_PKG}::$_" } | ||
| 66 | qw(errValueType extErrValueType)), | ||
| 67 | ; | ||
| 68 | |||
| 69 | has_element 'errors' => | ||
| 70 | is => "rw", | ||
| 71 | isa => "ArrayRef[${PKG}::choice0]", | ||
| 72 | predicate => "has_errs", | ||
| 73 | xmlns => XML::EPP::Node::xmlns(), | ||
| 74 | traits => [qw/Array/], | ||
| 75 | xml_nodeName => { | ||
| 76 | "value" => "PRANG::XMLSchema::Whatever", | ||
| 77 | "extValue" => "${SCHEMA_PKG}::Error", | ||
| 78 | }, | ||
| 79 | handles => { | ||
| 80 | add_error => 'push', | ||
| 81 | }, | ||
| 82 | default => sub { [] }, | ||
| 83 | xml_min => 0, | ||
| 84 | ; | ||
| 85 | |||
| 86 | subtype "${SCHEMA_PKG}::resultCodeType" | ||
| 87 | => as "Int" | ||
| 88 | => where { | ||
| 89 | exists $result_codes{$_}; | ||
| 90 | }; | ||
| 91 | |||
| 92 | has_attr 'code' => | ||
| 93 | is => "rw", | ||
| 94 | isa => "${SCHEMA_PKG}::resultCodeType", | ||
| 95 | ; | ||
| 96 | |||
| 97 | with 'XML::EPP::Node'; | ||
| 98 | |||
| 99 | subtype "${SCHEMA_PKG}::resultType" | ||
| 100 | => as __PACKAGE__; | ||
| 101 | |||
| 102 | sub is_command { 0 } | ||
| 103 | |||
| 104 | 1; | ||