| 1 | # vim: filetype=perl:noexpandtab:ts=3:sw=3 | ||
| 2 | # | ||
| 3 | # Copyright (C) 2009 NZ Registry Services | ||
| 4 | # | ||
| 5 | # This program is free software: you can redistribute it and/or modify | ||
| 6 | # it under the terms of the Artistic License 2.0 or later. You should | ||
| 7 | # have received a copy of the Artistic License the file COPYING.txt. | ||
| 8 | # If not, see <http://www.perlfoundation.org/artistic_license_2_0> | ||
| 9 | 2 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 10 | 2 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 11 | |||
| 12 | package SRS::EPP::Response; | ||
| 13 | 2 | ▶ | use Moose; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 14 | 2 | ▶ | use Moose::Util::TypeConstraints; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 15 | 2 | ▶ | use MooseX::Method::Signatures; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 16 | extends 'SRS::EPP::Message'; | ||
| 17 | |||
| 18 | 2 | ▶ | use SRS::EPP::SRSResponse; |
|
Subroutine
BEGIN: called CC=1 SCAR=2.6
| |||
| 19 | |||
| 20 | has 'code' => | ||
| 21 | is => 'ro', | ||
| 22 | isa => "XML::EPP::resultCodeType", | ||
| 23 | required => 1, | ||
| 24 | ; | ||
| 25 | |||
| 26 | has 'extra' => | ||
| 27 | is => "ro", | ||
| 28 | isa => "Str", | ||
| 29 | ; | ||
| 30 | |||
| 31 | use XML::EPP; | ||
| 32 | has "+message" => | ||
| 33 | isa => "XML::EPP", | ||
| 34 | default => sub { | ||
| 35 | my $self = shift; | ||
| 36 | my $server_id = $self->server_id; | ||
| 37 | my $client_id = $self->client_id; | ||
| 38 | my $tx_id; | ||
| 39 | if ( $server_id ) { | ||
| 40 | $tx_id = XML::EPP::TrID->new( | ||
| 41 | server_id => $server_id, | ||
| 42 | ($client_id ? (client_id => $client_id) : () ), | ||
| 43 | ); | ||
| 44 | } | ||
| 45 | my $msg = $self->extra; | ||
| 46 | my $result = XML::EPP::Result->new( | ||
| 47 | ($msg ? (msg => $msg) : ()), | ||
| 48 | code => $self->code, | ||
| 49 | ); | ||
| 50 | XML::EPP->new( | ||
| 51 | message => XML::EPP::Response->new( | ||
| 52 | result => [ $result ], | ||
| 53 | ($tx_id ? (tx_id => $tx_id) : () ), | ||
| 54 | ), | ||
| 55 | ); | ||
| 56 | }, | ||
| 57 | ; | ||
| 58 | |||
| 59 | has "client_id" => | ||
| 60 | is => "ro", | ||
| 61 | isa => "XML::EPP::trIDStringType", | ||
| 62 | ; | ||
| 63 | |||
| 64 | # not all response types require a server_id | ||
| 65 | has "server_id" => | ||
| 66 | is => "ro", | ||
| 67 | isa => "XML::EPP::trIDStringType", | ||
| 68 | ; | ||
| 69 | |||
| 70 | use Module::Pluggable | ||
| 71 | require => 1, | ||
| 72 | search_path => [__PACKAGE__], | ||
| 73 | ; | ||
| 74 | |||
| 75 | __PACKAGE__->plugins; | ||
| 76 | |||
| 77 | no Moose; | ||
| 78 | __PACKAGE__->meta->make_immutable; | ||
| 79 | |||
| 80 | 1; | ||
| 81 | |||
| 82 | __END__ | ||
| 83 | |||
| 84 | =head1 NAME | ||
| 85 | |||
| 86 | SRS::EPP::Response - EPP XML | ||
| 87 | |||
| 88 | =head1 SYNOPSIS | ||
| 89 | |||
| 90 | ... | ||
| 91 | |||
| 92 | =head1 DESCRIPTION | ||
| 93 | |||
| 94 | This is a base class for all EPP responses. | ||
| 95 | |||
| 96 | =head1 SEE ALSO | ||
| 97 | |||
| 98 | L<SRS::EPP::Message> | ||
| 99 | |||
| 100 | =cut | ||
| 101 | |||
| 102 | # Local Variables: | ||
| 103 | # mode:cperl | ||
| 104 | # indent-tabs-mode: t | ||
| 105 | # cperl-continued-statement-offset: 8 | ||
| 106 | # cperl-brace-offset: 0 | ||
| 107 | # cperl-close-paren-offset: 0 | ||
| 108 | # cperl-continued-brace-offset: 0 | ||
| 109 | # cperl-continued-statement-offset: 8 | ||
| 110 | # cperl-extra-newline-before-brace: nil | ||
| 111 | # cperl-indent-level: 8 | ||
| 112 | # cperl-indent-parens-as-block: t | ||
| 113 | # cperl-indent-wrt-brace: nil | ||
| 114 | # cperl-label-offset: -8 | ||
| 115 | # cperl-merge-trailing-else: t | ||
| 116 | # End: | ||