File Coverage

blib/lib/Net/EPP/Frame/ObjectSpec.pm
Criterion Covered Total %
statement 6 9 66.6
branch 0 2 0.0
condition n/a
subroutine 2 3 66.6
pod 0 1 0.0
total 8 15 53.3


line stmt bran cond sub pod time code
1             package Net::EPP::Frame::ObjectSpec;
2 1     1   7 use vars qw($SPEC);
  1         2  
  1         42  
3 1     1   6 use strict;
  1         3  
  1         118  
4              
5             our $SPEC = {
6             'domain' => [ 'urn:ietf:params:xml:ns:domain-1.0', 'urn:ietf:params:xml:ns:domain-1.0 domain-1.0.xsd' ],
7             'contact' => [ 'urn:ietf:params:xml:ns:contact-1.0', 'urn:ietf:params:xml:ns:contact-1.0 contact-1.0.xsd' ],
8             'host' => [ 'urn:ietf:params:xml:ns:host-1.0', 'urn:ietf:params:xml:ns:host-1.0 host-1.0.xsd' ],
9             'secDNS' => [ 'urn:ietf:params:xml:ns:secDNS-1.1', 'urn:ietf:params:xml:ns:secDNS-1.1 secDNS-1.1.xsd' ],
10             };
11              
12             sub spec {
13 0     0 0   my $type = $_[1];
14              
15 0 0         return (!defined($SPEC->{$type}) ? undef : ($type, @{$SPEC->{$type}}));
  0            
16             }
17              
18             =pod
19              
20             =head1 NAME
21              
22             Net::EPP::Frame::ObjectSpec - metadata about EPP object types
23              
24             =head1 SYNOPSIS
25              
26             use Net::EPP::Frame;
27             use strict;
28              
29             # create an EPP frame:
30             my $check = Net::EPP::Frame::Command::Check->new;
31              
32             # get the spec:
33             my @spec = Net::EPP::Frame::ObjectSpec->spec('domain');
34              
35             # create an object:
36             my $domain = $check->addObject(@spec);
37              
38             # set the attributes:
39             my $name = $check->createElement('domain:name');
40             $name->addText('example.tld');
41              
42             # assemble the frame:
43             $domain->appendChild($name);
44             $check->getCommandNode->appendChild($domain);
45              
46             print $check->toString;
47              
48             =head1 DESCRIPTION
49              
50             EPP is the Extensible Provisioning Protocol. EPP (defined in RFC 4930) is an
51             application layer client-server protocol for the provisioning and management of
52             objects stored in a shared central repository. Specified in XML, the protocol
53             defines generic object management operations and an extensible framework that
54             maps protocol operations to objects. As of writing, its only well-developed
55             application is the provisioning of Internet domain names, hosts, and related
56             contact details.
57              
58             Net::EPP::Frame::ObjectSpec is a simple module designed to provide easy access to
59             metadata for the object types defined in the EPP specification.
60              
61             =head1 USAGE
62              
63             my @spec = Net::EPP::Frame::ObjectSpec->spec($type);
64              
65             This function returns an array containing metadata for the given object type.
66             If no metadata is registered then the function returns undef.
67              
68             The array contains three members:
69              
70             @spec = (
71             $type,
72             $xmlns,
73             $schemaLocation,
74             );
75              
76             C<$type> is the same as the supplied argument, and the other two members
77             correspond to the XML attributes used to specify the object in an EPP
78             CcommandE> or CresponseE> frame.
79              
80             The objects currently registered are:
81              
82             =over
83              
84             =item * C, for domain names.
85              
86             =item * C, for DNS server hosts.
87              
88             =item * C, for contact objects.
89              
90             =item * C, for DNSSEC information.
91              
92             =back
93              
94             Note that secDNS is an extension to the domain object rather than an
95             object in its own right.
96              
97             =cut
98              
99             1;