EPP/Frame/ObjectSpec.pm

filter: Statementstmt 61.5% 8 / 13 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 50.0% 2 / 4 Podpod 100% 2 / 2 totaltotal 57.1% 12 / 21 CC 2 SCAR 11.6
CC
2
Cov
53%
spec
6.0
xmlns
2.0
BEGIN
1.0
CRAP 3.2
« EPP/Frame.pm ↑ Summary EPP/Frame/Response.pm »
1 package Net::EPP::Frame::ObjectSpec;
2 1 ▶use vars qw($SPEC);
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 1 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 0 ▶sub spec {
Subroutine spec: not called CC=2 SCAR=17.9
Pod documented
27 0 my ($package, $type) = @_;
28  
29 0 ▶ return (!defined($SPEC->{$type}) ? undef : ($type, @{$SPEC->{$type}}));
Branch: 1 branch
BranchTrueFalseTotal
!defined($Net::EPP::Frame::ObjectSpec::SPEC->{$type}) ? : 0 0 0
30 }
31  
32 0 ▶sub xmlns {
Subroutine xmlns: not called CC=1 SCAR=6.9
Pod documented
33 0 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<Net::EPP::Frame::ObjectSpec> 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<xmlns()>
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<undef> if C<$type> is unknown.
81  
82 See below for possible values of C<$type>.
83  
84 =head2 C<spec()>
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<undef>.
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<schemaLocation> attribute, but is now deprecated and will be C<undef> for
102 any value of C<$type> other than C<domain>, C<host> C<contact>, C<secDNS> and
103 C<rgp>.
104  
105 =head1 THE C<$type> ARGUMENT
106  
107 The C<$type> argument to C<xmlns()> and C<spec()> identifies the object or
108 extension desired. Possible values are:
109  
110 =head2 OBJECT MAPPINGS
111  
112 =over
113  
114 =item * C<domain>, for domain names;
115  
116 =item * C<host>, for host objects;
117  
118 =item * C<contact>, for contact objects;
119  
120 =item * C<org>, for organization object.
121  
122 =back
123  
124 =head2 EXTENSIONS
125  
126 =over
127  
128 =item * C<secDNS>, for the DNSSEC extension;
129  
130 =item * C<rgp>, for Registry Grace Period extension;
131  
132 =item * C<ttl>, for the TTL extension;
133  
134 =item * C<maintenance>, for the Maintenance extension;
135  
136 =item * C<secure-authinfo-transfer>, for the Secure authInfo extension;
137  
138 =item * C<b-dn>, for the bundled domain names extension;
139  
140 =item * C<unhandled-namespaces>, for the unhandled namespaces extension;
141  
142 =item * C<loginSec>, for the Login Security extension;
143  
144 =item * C<fee>, for the Fee extension;
145  
146 =item * C<changePoll>, for the Change Poll extension;
147  
148 =item * C<orgext>, for the Organization extension;
149  
150 =item * C<allocationToken>, for the Allocation Token extension;
151  
152 =item * C<launch>, for the Launch extension;
153  
154 =item * C<keyrelay>, for the Key Relay extension;
155  
156 =item * C<ttl>, 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 1;
« EPP/Frame.pm ↑ Summary EPP/Frame/Response.pm »