Net::EPP::Frame::Response - an instance of L<Net::EPP::Frame> for server responses


Net-EPP documentation Contained in the Net-EPP distribution.

Index


Code Index:

NAME

Top

Net::EPP::Frame::Response - an instance of Net::EPP::Frame for server responses

DESCRIPTION

Top

This module is a subclass of Net::EPP::Frame that represents EPP server responses.

Responses are sent back to clients when the server receives a <command> frame.

OBJECT HIERARCHY

Top

    L<XML::LibXML::Node>
    +----L<XML::LibXML::Document>
        +----L<Net::EPP::Frame>
            +----L<Net::EPP::Frame::Response>

METHODS

Top

	my $node = $frame->response;

This method returns the XML::LibXML::Element object corresponding to the <command> element.

	my $node = $frame->result;

This method returns the XML::LibXML::Element object corresponding to the <result> element.

	my $node = $frame->msg;

This method returns the XML::LibXML::Element object corresponding to the <msg> element.

	my $node = $frame->resData;

This method returns the XML::LibXML::Element object corresponding to the <resData> element.

	my $node = $frame->trID;

This method returns the XML::LibXML::Element object corresponding to the <trID> element.

	my $node = $frame->clTRID;

This method returns the XML::LibXML::Element object corresponding to the <clTRID> element.

	my $node = $frame->svTRID;

This method returns the XML::LibXML::Element object corresponding to the <svTRID> element.

	my $msg = $frame->code;

This method returns the code attribute of the <result> element.

	my $msg = $frame->msg;

This method returns a string containing the text content of the <msg> element.

AUTHOR

Top

CentralNic Ltd (http://www.centralnic.com/).

COPYRIGHT

Top

SEE ALSO

Top

* Net::EPP::Frame

Net-EPP documentation Contained in the Net-EPP distribution.
# Copyright (c) 2011 CentralNic Ltd. All rights reserved. This program is
# free software; you can redistribute it and/or modify it under the same
# terms as Perl itself.
# 
# $Id: Response.pm,v 1.9 2011/07/04 09:48:51 gavin Exp $
package Net::EPP::Frame::Response;
use Net::EPP::ResponseCodes;
use base qw(Net::EPP::Frame);

sub new {
	my $package = shift;
	my $self = $package->SUPER::new('response');
	return bless($self, $package);
}

sub _addExtraElements {
	my $self = shift;

	my $result = $self->createElement('result');
	$result->appendChild($self->createElement('msg'));
	$self->response->addChild($result);

	$self->result->setAttribute('code' => COMMAND_FAILED);

	$self->response->addChild($self->createElement('resData'));

	my $trID = $self->createElement('trID');
	$trID->addChild($self->createElement('clTRID'));
	$trID->addChild($self->createElement('svTRID'));
	$self->response->addChild($trID);

	return 1;
}

sub response {$_[0]->getNode('response') }
sub result {$_[0]->getNode('result') }
sub resData {$_[0]->getNode('resData') }
sub trID {$_[0]->getNode('trID') }
sub clTRID {$_[0]->getNode('clTRID') }
sub svTRID {$_[0]->getNode('svTRID') }

sub code {
	 my $self = shift;
	 my $result = $self->result;
	 if ($result) {
		  return $result->getAttribute('code');
	 }
	 return COMMAND_FAILED;
}

sub msg {
	my $self = shift;
	my $msgs = $self->getElementsByLocalName('msg');
	return $msgs->shift->textContent if ($msgs->size == 1);
}

1;