File Coverage

blib/lib/Net/EPP/Frame/ObjectSpec.pm
Criterion Covered Total %
statement 6 11 54.5
branch 0 2 0.0
condition n/a
subroutine 2 4 50.0
pod 2 2 100.0
total 10 19 52.6


line stmt bran cond sub pod time code
1             package Net::EPP::Frame::ObjectSpec;
2 1     1   9 use vars qw($SPEC);
  1         3  
  1         64  
3 1     1   17 use strict;
  1         3  
  1         342  
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             'rgp' => ['urn:ietf:params:xml:ns:rgp-1.0', 'urn:ietf:params:xml:ns:rgp-1.0 rgp-1.0.xsd'],
11             'maintenance' => ['urn:ietf:params:xml:ns:epp:maintenance-1.0'],
12             'secure-authinfo-transfer' => ['urn:ietf:params:xml:ns:epp:secure-authinfo-transfer-1.0'],
13             'b-dn' => ['urn:ietf:params:xml:ns:epp:b-dn'],
14             'unhandled-namespaces' => ['urn:ietf:params:xml:ns:epp:unhandled-namespaces-1.0'],
15             'loginSec' => ['urn:ietf:params:xml:ns:epp:loginSec-1.0'],
16             'fee' => ['urn:ietf:params:xml:ns:epp:fee-1.0'],
17             'changePoll' => ['urn:ietf:params:xml:ns:changePoll-1.0'],
18             'orgext' => ['urn:ietf:params:xml:ns:epp:orgext-1.0'],
19             'org' => ['urn:ietf:params:xml:ns:epp:org-1.0'],
20             'allocationToken' => ['urn:ietf:params:xml:ns:allocationToken-1.0'],
21             'launch' => ['urn:ietf:params:xml:ns:launch-1.0'],
22             'keyrelay' => ['urn:ietf:params:xml:ns:keyrelay-1.0'],
23             'ttl' => ['urn:ietf:params:xml:ns:epp:ttl-1.0'],
24             };
25              
26             sub spec {
27 0     0 1   my ($package, $type) = @_;
28              
29 0 0         return (!defined($SPEC->{$type}) ? undef : ($type, @{$SPEC->{$type}}));
  0            
30             }
31              
32             sub xmlns {
33 0     0 1   my ($package, $type) = @_;
34 0           return $SPEC->{$type}->[0];
35             }
36              
37             =pod
38              
39             =head1 NAME
40              
41             Net::EPP::Frame::ObjectSpec - metadata about EPP objects and extensions.
42              
43             =head1 SYNOPSIS
44              
45             use Net::EPP::Frame;
46             use strict;
47              
48             # create an EPP frame:
49             my $check = Net::EPP::Frame::Command::Check->new;
50              
51             # get the spec:
52             my @spec = Net::EPP::Frame::ObjectSpec->spec('domain');
53              
54             # create an object:
55             my $domain = $check->addObject(@spec);
56              
57             # set the attributes:
58             my $name = $check->createElement('domain:name');
59             $name->addText('example.tld');
60              
61             # assemble the frame:
62             $domain->appendChild($name);
63             $check->getCommandNode->appendChild($domain);
64              
65             print $check->toString;
66              
67             =head1 DESCRIPTION
68              
69             C is a simple module designed to provide easy access
70             to metadata for the objects and extensions defined in EPP and various
71             extensions.
72              
73             =head1 METHODS
74              
75             =head2 C
76              
77             my $xmlns = Net::EPP::Frame::ObjectSpec->xmlns($type);
78              
79             Returns a string containing the XML namespace URI of the thing identified by
80             C<$type>, or C if C<$type> is unknown.
81              
82             See below for possible values of C<$type>.
83              
84             =head2 C
85              
86             my @spec = Net::EPP::Frame::ObjectSpec->spec($type);
87              
88             This function returns an array containing metadata for the given object type.
89             If no metadata is registered then the function returns C.
90              
91             The returned array contains three members:
92              
93             @spec = (
94             $type,
95             $xmlns,
96             $schemaLocation, # (deprecated)
97             );
98              
99             C<$type> is the same as the supplied argument, while C<$xmlns> is the XML
100             namespace URI for the given type. The third argument is suitable for inclusion
101             in a C attribute, but is now deprecated and will be C for
102             any value of C<$type> other than C, C C, C and
103             C.
104              
105             =head1 THE C<$type> ARGUMENT
106              
107             The C<$type> argument to C and C identifies the object or
108             extension desired. Possible values are:
109              
110             =head2 OBJECT MAPPINGS
111              
112             =over
113              
114             =item * C, for domain names;
115              
116             =item * C, for host objects;
117              
118             =item * C, for contact objects;
119              
120             =item * C, for organization object.
121              
122             =back
123              
124             =head2 EXTENSIONS
125              
126             =over
127              
128             =item * C, for the DNSSEC extension;
129              
130             =item * C, for Registry Grace Period extension;
131              
132             =item * C, for the TTL extension;
133              
134             =item * C, for the Maintenance extension;
135              
136             =item * C, for the Secure authInfo extension;
137              
138             =item * C, for the bundled domain names extension;
139              
140             =item * C, for the unhandled namespaces extension;
141              
142             =item * C, for the Login Security extension;
143              
144             =item * C, for the Fee extension;
145              
146             =item * C, for the Change Poll extension;
147              
148             =item * C, for the Organization extension;
149              
150             =item * C, for the Allocation Token extension;
151              
152             =item * C, for the Launch extension;
153              
154             =item * C, for the Key Relay extension;
155              
156             =item * C, for the TTL extension.
157              
158             =back
159              
160             =head1 COPYRIGHT
161              
162             This module is (c) 2008 - 2023 CentralNic Ltd and 2024 Gavin Brown. This module
163             is free software; you can redistribute it and/or modify it under the same terms
164             as Perl itself.
165              
166             =cut
167              
168             1;