Peter Pentchev

NAME

WWW::Domain::Registry::Joker::Response - parse a DMAPI response

SYNOPSIS

  use WWW::Domain::Registry::Joker::Response;

  $r = new WWW::Domain::Registry::Joker::Response();
  $r->parse($resp);
  print "$r->{Proc-Id}: $r->{'Status-Code'} $r->{Status-Text}\n";

DESCRIPTION

The WWW::Domain::Registry::Joker::Response class is a helper parser for the HTTP responses returned by the Joker.com DMAPI. It examines a response object, extracts the status and error flags, codes, and descriptive messages, and makes them available as Perl object members.

METHODS

The WWW::Domain::Registry::Joker::Response class defines the following methods:

new ()

Initialize a WWW::Domain::Registry::Joker::Response object. No user-serviceable parameters inside.

parse ( RESPONSE )

Parse a HTTP::Response from the DMAPI and store the result code, message, error, etc. into the respective fields of the object. In addition to the code, msg, status, and success members described above, the parse() method may also set the Version, Proc-Id, Status-Text, Status-Code, Error, and any other result description members as listed in the DMAPI specification.

EXAMPLES

Create an object and parse an HTTP response:

  $r = new WWW::Domain::Registry::Joker::Response();
  eval {
        $r->parse($resp);
  };
  if ($@) {
        print STDERR "Could not parse the DMAPI response: $@\n";
  } elsif (!$r->{'success'}) {
        print STDERR "DMAPI error: code $r->{code}, text $r->{msg}\n";
        print STDERR "DMAPI error message: $r->{Error}\n"
            if $r->{'Error'};
  } else {
        print "Successful DMAPI request: $r->{code} $r->{msg}\n";
        print "Tracking process ID: $r->{Proc-ID}\n" if $r->{'Proc-ID'};
  }

ERRORS

The parse() method will die on invalid input:

  • no response parameter passed in;

  • the response parameter was not an HTTP::Response or compatible object.

If the response object is a valid DMAPI response, its success, code, msg, Error, and other attributes are exposed as members of the WWW::Domain::Registry::Joker::Response object as shown above.

SEE ALSO

WWW::Domain::Registry::Joker, HTTP::Response

https://joker.com/faq/category/39/22-dmapi.html - the Joker.com DMAPI documentation

BUGS

None known so far ;)

HISTORY

The WWW::Domain::Registry::Joker::Response class was written by Peter Pentchev in 2007.

AUTHOR

Peter Pentchev, <roam@ringlet.net>

COPYRIGHT AND LICENSE

Copyright (C) 2007 by Peter Pentchev

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.