Filename | /usr/local/lib/perl5/site_perl/Net/DNS/Parameters.pm |
Statements | Executed 15792 statements in 163ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1970 | 3 | 3 | 31.7ms | 31.7ms | typebyname | Net::DNS::Parameters::
1968 | 1 | 1 | 27.2ms | 27.2ms | classbyval | Net::DNS::Parameters::
1969 | 2 | 2 | 26.4ms | 26.4ms | typebyval | Net::DNS::Parameters::
1968 | 1 | 1 | 25.7ms | 25.7ms | classbyname | Net::DNS::Parameters::
274 | 7 | 1 | 620µs | 620µs | CORE:match (opcode) | Net::DNS::Parameters::
1 | 1 | 1 | 200µs | 381µs | BEGIN@330 | Net::DNS::Parameters::
1 | 1 | 1 | 43µs | 51µs | BEGIN@17 | Net::DNS::Parameters::
1 | 1 | 1 | 22µs | 244µs | BEGIN@22 | Net::DNS::Parameters::
1 | 1 | 1 | 20µs | 42µs | BEGIN@18 | Net::DNS::Parameters::
1 | 1 | 1 | 18µs | 23µs | BEGIN@19 | Net::DNS::Parameters::
1 | 1 | 1 | 18µs | 143µs | BEGIN@20 | Net::DNS::Parameters::
0 | 0 | 0 | 0s | 0s | _typespec | Net::DNS::Parameters::
0 | 0 | 0 | 0s | 0s | ednsoptionbyname | Net::DNS::Parameters::
0 | 0 | 0 | 0s | 0s | ednsoptionbyval | Net::DNS::Parameters::
0 | 0 | 0 | 0s | 0s | opcodebyname | Net::DNS::Parameters::
0 | 0 | 0 | 0s | 0s | opcodebyval | Net::DNS::Parameters::
0 | 0 | 0 | 0s | 0s | rcodebyname | Net::DNS::Parameters::
0 | 0 | 0 | 0s | 0s | rcodebyval | Net::DNS::Parameters::
0 | 0 | 0 | 0s | 0s | register | Net::DNS::Parameters::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package Net::DNS::Parameters; | ||||
2 | |||||
3 | # | ||||
4 | # $Id: Parameters.pm 1598 2017-10-03 09:48:30Z willem $ | ||||
5 | # | ||||
6 | 1 | 2µs | our $VERSION = (qw$LastChangedRevision: 1598 $)[1]; | ||
7 | |||||
8 | |||||
9 | ################################################ | ||||
10 | ## | ||||
11 | ## Domain Name System (DNS) Parameters | ||||
12 | ## (last updated 2017-08-30) | ||||
13 | ## | ||||
14 | ################################################ | ||||
15 | |||||
16 | |||||
17 | 2 | 61µs | 2 | 59µs | # spent 51µs (43+8) within Net::DNS::Parameters::BEGIN@17 which was called:
# once (43µs+8µs) by Net::DNS::RR::BEGIN@41 at line 17 # spent 51µs making 1 call to Net::DNS::Parameters::BEGIN@17
# spent 8µs making 1 call to strict::import |
18 | 2 | 55µs | 2 | 65µs | # spent 42µs (20+23) within Net::DNS::Parameters::BEGIN@18 which was called:
# once (20µs+23µs) by Net::DNS::RR::BEGIN@41 at line 18 # spent 42µs making 1 call to Net::DNS::Parameters::BEGIN@18
# spent 23µs making 1 call to warnings::import |
19 | 2 | 49µs | 2 | 28µs | # spent 23µs (18+5) within Net::DNS::Parameters::BEGIN@19 which was called:
# once (18µs+5µs) by Net::DNS::RR::BEGIN@41 at line 19 # spent 23µs making 1 call to Net::DNS::Parameters::BEGIN@19
# spent 5µs making 1 call to integer::import |
20 | 2 | 56µs | 2 | 268µs | # spent 143µs (18+125) within Net::DNS::Parameters::BEGIN@20 which was called:
# once (18µs+125µs) by Net::DNS::RR::BEGIN@41 at line 20 # spent 143µs making 1 call to Net::DNS::Parameters::BEGIN@20
# spent 125µs making 1 call to Exporter::import |
21 | |||||
22 | 2 | 2.58ms | 2 | 244µs | # spent 244µs (22+222) within Net::DNS::Parameters::BEGIN@22 which was called:
# once (22µs+222µs) by Net::DNS::RR::BEGIN@41 at line 22 # spent 244µs making 1 call to Net::DNS::Parameters::BEGIN@22
# spent 222µs making 1 call to base::import, recursion: max depth 2, sum of overlapping time 222µs |
23 | 1 | 5µs | our @EXPORT = qw( | ||
24 | classbyname classbyval %classbyname | ||||
25 | typebyname typebyval %typebyname | ||||
26 | opcodebyname opcodebyval | ||||
27 | rcodebyname rcodebyval | ||||
28 | ednsoptionbyname ednsoptionbyval | ||||
29 | ); | ||||
30 | |||||
31 | |||||
32 | # Registry: DNS CLASSes | ||||
33 | 1 | 3µs | my @classbyname = ( | ||
34 | IN => 1, # RFC1035 | ||||
35 | CH => 3, # Chaosnet | ||||
36 | HS => 4, # Hesiod | ||||
37 | NONE => 254, # RFC2136 | ||||
38 | ANY => 255, # RFC1035 | ||||
39 | ); | ||||
40 | 1 | 17µs | our %classbyval = reverse @classbyname, ( CLASS0 => 0 ); | ||
41 | 1 | 97µs | 10 | 26µs | push @classbyname, map /^\d/ ? $_ : lc($_), @classbyname; # spent 26µs making 10 calls to Net::DNS::Parameters::CORE:match, avg 3µs/call |
42 | 1 | 11µs | our %classbyname = ( '*' => 255, @classbyname ); | ||
43 | |||||
44 | |||||
45 | # Registry: Resource Record (RR) TYPEs | ||||
46 | 1 | 23µs | my @typebyname = ( | ||
47 | A => 1, # RFC1035 | ||||
48 | NS => 2, # RFC1035 | ||||
49 | MD => 3, # RFC1035 | ||||
50 | MF => 4, # RFC1035 | ||||
51 | CNAME => 5, # RFC1035 | ||||
52 | SOA => 6, # RFC1035 | ||||
53 | MB => 7, # RFC1035 | ||||
54 | MG => 8, # RFC1035 | ||||
55 | MR => 9, # RFC1035 | ||||
56 | NULL => 10, # RFC1035 | ||||
57 | WKS => 11, # RFC1035 | ||||
58 | PTR => 12, # RFC1035 | ||||
59 | HINFO => 13, # RFC1035 | ||||
60 | MINFO => 14, # RFC1035 | ||||
61 | MX => 15, # RFC1035 | ||||
62 | TXT => 16, # RFC1035 | ||||
63 | RP => 17, # RFC1183 | ||||
64 | AFSDB => 18, # RFC1183 RFC5864 | ||||
65 | X25 => 19, # RFC1183 | ||||
66 | ISDN => 20, # RFC1183 | ||||
67 | RT => 21, # RFC1183 | ||||
68 | NSAP => 22, # RFC1706 | ||||
69 | 'NSAP-PTR' => 23, # RFC1348 RFC1637 RFC1706 | ||||
70 | SIG => 24, # RFC4034 RFC3755 RFC2535 RFC2536 RFC2537 RFC2931 RFC3110 RFC3008 | ||||
71 | KEY => 25, # RFC4034 RFC3755 RFC2535 RFC2536 RFC2537 RFC2539 RFC3008 RFC3110 | ||||
72 | PX => 26, # RFC2163 | ||||
73 | GPOS => 27, # RFC1712 | ||||
74 | AAAA => 28, # RFC3596 | ||||
75 | LOC => 29, # RFC1876 | ||||
76 | NXT => 30, # RFC3755 RFC2535 | ||||
77 | EID => 31, # http://ana-3.lcs.mit.edu/~jnc/nimrod/dns.txt | ||||
78 | NIMLOC => 32, # http://ana-3.lcs.mit.edu/~jnc/nimrod/dns.txt | ||||
79 | SRV => 33, # RFC2782 | ||||
80 | ATMA => 34, # http://www.broadband-forum.org/ftp/pub/approved-specs/af-dans-0152.000.pdf | ||||
81 | NAPTR => 35, # RFC2915 RFC2168 RFC3403 | ||||
82 | KX => 36, # RFC2230 | ||||
83 | CERT => 37, # RFC4398 | ||||
84 | A6 => 38, # RFC3226 RFC2874 RFC6563 | ||||
85 | DNAME => 39, # RFC6672 | ||||
86 | SINK => 40, # http://tools.ietf.org/html/draft-eastlake-kitchen-sink | ||||
87 | OPT => 41, # RFC6891 RFC3225 | ||||
88 | APL => 42, # RFC3123 | ||||
89 | DS => 43, # RFC4034 RFC3658 | ||||
90 | SSHFP => 44, # RFC4255 | ||||
91 | IPSECKEY => 45, # RFC4025 | ||||
92 | RRSIG => 46, # RFC4034 RFC3755 | ||||
93 | NSEC => 47, # RFC4034 RFC3755 | ||||
94 | DNSKEY => 48, # RFC4034 RFC3755 | ||||
95 | DHCID => 49, # RFC4701 | ||||
96 | NSEC3 => 50, # RFC5155 | ||||
97 | NSEC3PARAM => 51, # RFC5155 | ||||
98 | TLSA => 52, # RFC6698 | ||||
99 | SMIMEA => 53, # RFC8162 | ||||
100 | HIP => 55, # RFC8005 | ||||
101 | NINFO => 56, # | ||||
102 | RKEY => 57, # | ||||
103 | TALINK => 58, # | ||||
104 | CDS => 59, # RFC7344 | ||||
105 | CDNSKEY => 60, # RFC7344 | ||||
106 | OPENPGPKEY => 61, # RFC7929 | ||||
107 | CSYNC => 62, # RFC7477 | ||||
108 | SPF => 99, # RFC7208 | ||||
109 | UINFO => 100, # IANA-Reserved | ||||
110 | UID => 101, # IANA-Reserved | ||||
111 | GID => 102, # IANA-Reserved | ||||
112 | UNSPEC => 103, # IANA-Reserved | ||||
113 | NID => 104, # RFC6742 | ||||
114 | L32 => 105, # RFC6742 | ||||
115 | L64 => 106, # RFC6742 | ||||
116 | LP => 107, # RFC6742 | ||||
117 | EUI48 => 108, # RFC7043 | ||||
118 | EUI64 => 109, # RFC7043 | ||||
119 | TKEY => 249, # RFC2930 | ||||
120 | TSIG => 250, # RFC2845 | ||||
121 | IXFR => 251, # RFC1995 | ||||
122 | AXFR => 252, # RFC1035 RFC5936 | ||||
123 | MAILB => 253, # RFC1035 | ||||
124 | MAILA => 254, # RFC1035 | ||||
125 | ANY => 255, # RFC1035 RFC6895 | ||||
126 | URI => 256, # RFC7553 | ||||
127 | CAA => 257, # RFC6844 | ||||
128 | AVC => 258, # | ||||
129 | DOA => 259, # draft-durand-doa-over-dns | ||||
130 | TA => 32768, # http://cameo.library.cmu.edu/ http://www.watson.org/~weiler/INI1999-19.pdf | ||||
131 | DLV => 32769, # RFC4431 | ||||
132 | ); | ||||
133 | 1 | 90µs | our %typebyval = reverse @typebyname, ( TYPE0 => 0 ); | ||
134 | 1 | 9.62ms | 170 | 379µs | push @typebyname, map /^\d/ ? $_ : lc($_), @typebyname; # spent 379µs making 170 calls to Net::DNS::Parameters::CORE:match, avg 2µs/call |
135 | 1 | 153µs | our %typebyname = ( '*' => 255, @typebyname ); | ||
136 | |||||
137 | |||||
138 | # Registry: DNS OpCodes | ||||
139 | 1 | 4µs | my @opcodebyname = ( | ||
140 | QUERY => 0, # RFC1035 | ||||
141 | IQUERY => 1, # RFC3425 | ||||
142 | STATUS => 2, # RFC1035 | ||||
143 | NOTIFY => 4, # RFC1996 | ||||
144 | UPDATE => 5, # RFC2136 | ||||
145 | ); | ||||
146 | 1 | 6µs | our %opcodebyval = reverse @opcodebyname; | ||
147 | 1 | 81µs | 10 | 24µs | push @opcodebyname, map /^\d/ ? $_ : lc($_), @opcodebyname; # spent 24µs making 10 calls to Net::DNS::Parameters::CORE:match, avg 2µs/call |
148 | 1 | 11µs | our %opcodebyname = ( NS_NOTIFY_OP => 4, @opcodebyname ); | ||
149 | |||||
150 | |||||
151 | # Registry: DNS RCODEs | ||||
152 | 1 | 8µs | my @rcodebyname = ( | ||
153 | NOERROR => 0, # RFC1035 | ||||
154 | FORMERR => 1, # RFC1035 | ||||
155 | SERVFAIL => 2, # RFC1035 | ||||
156 | NXDOMAIN => 3, # RFC1035 | ||||
157 | NOTIMP => 4, # RFC1035 | ||||
158 | REFUSED => 5, # RFC1035 | ||||
159 | YXDOMAIN => 6, # RFC2136 RFC6672 | ||||
160 | YXRRSET => 7, # RFC2136 | ||||
161 | NXRRSET => 8, # RFC2136 | ||||
162 | NOTAUTH => 9, # RFC2136 | ||||
163 | NOTAUTH => 9, # RFC2845 | ||||
164 | NOTZONE => 10, # RFC2136 | ||||
165 | BADVERS => 16, # RFC6891 | ||||
166 | BADSIG => 16, # RFC2845 | ||||
167 | BADKEY => 17, # RFC2845 | ||||
168 | BADTIME => 18, # RFC2845 | ||||
169 | BADMODE => 19, # RFC2930 | ||||
170 | BADNAME => 20, # RFC2930 | ||||
171 | BADALG => 21, # RFC2930 | ||||
172 | BADTRUNC => 22, # RFC4635 | ||||
173 | BADCOOKIE => 23, # RFC7873 | ||||
174 | ); | ||||
175 | 1 | 16µs | our %rcodebyval = reverse( BADSIG => 16, @rcodebyname ); | ||
176 | 1 | 288µs | 42 | 94µs | push @rcodebyname, map /^\d/ ? $_ : lc($_), @rcodebyname; # spent 94µs making 42 calls to Net::DNS::Parameters::CORE:match, avg 2µs/call |
177 | 1 | 40µs | our %rcodebyname = @rcodebyname; | ||
178 | |||||
179 | |||||
180 | # Registry: DNS EDNS0 Option Codes (OPT) | ||||
181 | 1 | 6µs | my @ednsoptionbyname = ( | ||
182 | LLQ => 1, # http://files.dns-sd.org/draft-sekar-dns-llq.txt | ||||
183 | UL => 2, # http://files.dns-sd.org/draft-sekar-dns-ul.txt | ||||
184 | NSID => 3, # RFC5001 | ||||
185 | DAU => 5, # RFC6975 | ||||
186 | DHU => 6, # RFC6975 | ||||
187 | N3U => 7, # RFC6975 | ||||
188 | 'CLIENT-SUBNET' => 8, # RFC7871 | ||||
189 | EXPIRE => 9, # RFC7314 | ||||
190 | COOKIE => 10, # RFC7873 | ||||
191 | 'TCP-KEEPALIVE' => 11, # RFC7828 | ||||
192 | PADDING => 12, # RFC7830 | ||||
193 | CHAIN => 13, # RFC7901 | ||||
194 | 'KEY-TAG' => 14, # RFC8145 | ||||
195 | DEVICEID => 26946, # https://docs.umbrella.com/developer/networkdevices-api/identifying-dns-traffic2 | ||||
196 | ); | ||||
197 | 1 | 11µs | our %ednsoptionbyval = reverse @ednsoptionbyname; | ||
198 | 1 | 185µs | 28 | 63µs | push @ednsoptionbyname, map /^\d/ ? $_ : lc($_), @ednsoptionbyname; # spent 63µs making 28 calls to Net::DNS::Parameters::CORE:match, avg 2µs/call |
199 | 1 | 29µs | our %ednsoptionbyname = @ednsoptionbyname; | ||
200 | |||||
201 | |||||
202 | # Registry: DNS Header Flags | ||||
203 | 1 | 13µs | my @dnsflagbyname = ( | ||
204 | AA => 0x0400, # RFC1035 | ||||
205 | TC => 0x0200, # RFC1035 | ||||
206 | RD => 0x0100, # RFC1035 | ||||
207 | RA => 0x0080, # RFC1035 | ||||
208 | AD => 0x0020, # RFC4035 RFC6840 | ||||
209 | CD => 0x0010, # RFC4035 RFC6840 | ||||
210 | ); | ||||
211 | 1 | 86µs | 12 | 29µs | push @dnsflagbyname, map /^\d/ ? $_ : lc($_), @dnsflagbyname; # spent 29µs making 12 calls to Net::DNS::Parameters::CORE:match, avg 2µs/call |
212 | 1 | 14µs | our %dnsflagbyname = @dnsflagbyname; | ||
213 | |||||
214 | |||||
215 | # Registry: EDNS Header Flags (16 bits) | ||||
216 | 1 | 2µs | my @ednsflagbyname = ( | ||
217 | DO => 0x8000, # RFC4035 RFC3225 RFC6840 | ||||
218 | ); | ||||
219 | 1 | 19µs | 2 | 5µs | push @ednsflagbyname, map /^\d/ ? $_ : lc($_), @ednsflagbyname; # spent 5µs making 2 calls to Net::DNS::Parameters::CORE:match, avg 3µs/call |
220 | 1 | 3µs | our %ednsflagbyname = @ednsflagbyname; | ||
221 | |||||
222 | |||||
223 | ######## | ||||
224 | |||||
225 | # The following functions are wrappers around similarly named hashes. | ||||
226 | |||||
227 | # spent 25.7ms within Net::DNS::Parameters::classbyname which was called 1968 times, avg 13µs/call:
# 1968 times (25.7ms+0s) by Net::DNS::Question::new at line 82 of Net/DNS/Question.pm, avg 13µs/call | ||||
228 | 1968 | 4.51ms | my $name = shift; | ||
229 | |||||
230 | 1968 | 23.8ms | $classbyname{$name} || $classbyname{uc $name} || do { | ||
231 | croak "unknown class $name" unless $name =~ m/^(CLASS)?(\d+)/i; | ||||
232 | my $val = 0 + $2; | ||||
233 | croak "classbyname( $name ) out of range" if $val > 0xffff; | ||||
234 | return $val; | ||||
235 | } | ||||
236 | } | ||||
237 | |||||
238 | # spent 27.2ms within Net::DNS::Parameters::classbyval which was called 1968 times, avg 14µs/call:
# 1968 times (27.2ms+0s) by Net::DNS::Question::class at line 258 of Net/DNS/Question.pm, avg 14µs/call | ||||
239 | 1968 | 4.29ms | my $val = shift; | ||
240 | |||||
241 | 1968 | 35.4ms | $classbyval{$val} || do { | ||
242 | $val += 0; | ||||
243 | croak "classbyval( $val ) out of range" if $val > 0xffff; | ||||
244 | return "CLASS$val"; | ||||
245 | } | ||||
246 | } | ||||
247 | |||||
248 | |||||
249 | # spent 31.7ms within Net::DNS::Parameters::typebyname which was called 1970 times, avg 16µs/call:
# 1968 times (31.7ms+0s) by Net::DNS::Question::new at line 81 of Net/DNS/Question.pm, avg 16µs/call
# once (9µs+0s) by Net::DNS::RR::OPT::BEGIN@27 at line 27 of Net/DNS/RR/OPT.pm
# once (8µs+0s) by Net::DNS::RR::_subclass at line 675 of Net/DNS/RR.pm | ||||
250 | 1970 | 4.94ms | my $name = shift; | ||
251 | |||||
252 | 1970 | 46.7ms | $typebyname{$name} || do { | ||
253 | if ( $name =~ m/^(TYPE)?(\d+)/i ) { | ||||
254 | my $val = 0 + $2; | ||||
255 | croak "typebyname( $name ) out of range" if $val > 0xffff; | ||||
256 | return $val; | ||||
257 | } | ||||
258 | _typespec("$name.RRNAME") unless $typebyname{uc $name}; | ||||
259 | return $typebyname{uc $name} || croak "unknown type $name"; | ||||
260 | } | ||||
261 | } | ||||
262 | |||||
263 | # spent 26.4ms within Net::DNS::Parameters::typebyval which was called 1969 times, avg 13µs/call:
# 1968 times (26.4ms+0s) by Net::DNS::Question::type at line 236 of Net/DNS/Question.pm, avg 13µs/call
# once (11µs+0s) by Net::DNS::RR::_subclass at line 680 of Net/DNS/RR.pm | ||||
264 | 1969 | 3.86ms | my $val = shift; | ||
265 | |||||
266 | 1969 | 25.4ms | $typebyval{$val} || do { | ||
267 | $val += 0; | ||||
268 | croak "typebyval( $val ) out of range" if $val > 0xffff; | ||||
269 | $typebyval{$val} = "TYPE$val"; | ||||
270 | _typespec("$val.RRTYPE"); | ||||
271 | return $typebyval{$val}; | ||||
272 | } | ||||
273 | } | ||||
274 | |||||
275 | |||||
276 | sub opcodebyname { | ||||
277 | my $arg = shift; | ||||
278 | return $opcodebyname{$arg} if defined $opcodebyname{$arg}; | ||||
279 | return 0 + $arg if $arg =~ /^\d/; | ||||
280 | croak "unknown opcode $arg"; | ||||
281 | } | ||||
282 | |||||
283 | sub opcodebyval { | ||||
284 | my $val = shift; | ||||
285 | $opcodebyval{$val} || return $val; | ||||
286 | } | ||||
287 | |||||
288 | |||||
289 | sub rcodebyname { | ||||
290 | my $arg = shift; | ||||
291 | return $rcodebyname{$arg} if defined $rcodebyname{$arg}; | ||||
292 | return 0 + $arg if $arg =~ /^\d/; | ||||
293 | croak "unknown rcode $arg"; | ||||
294 | } | ||||
295 | |||||
296 | sub rcodebyval { | ||||
297 | my $val = shift; | ||||
298 | $rcodebyval{$val} || return $val; | ||||
299 | } | ||||
300 | |||||
301 | |||||
302 | sub ednsoptionbyname { | ||||
303 | my $arg = shift; | ||||
304 | return $ednsoptionbyname{$arg} if defined $ednsoptionbyname{$arg}; | ||||
305 | return 0 + $arg if $arg =~ /^\d/; | ||||
306 | croak "unknown option $arg"; | ||||
307 | } | ||||
308 | |||||
309 | sub ednsoptionbyval { | ||||
310 | my $val = shift; | ||||
311 | $ednsoptionbyval{$val} || return $val; | ||||
312 | } | ||||
313 | |||||
314 | |||||
315 | sub register { ## register( 'TOY', 1234 ) (NOT part of published API) | ||||
316 | my ( $mnemonic, $rrtype ) = map uc($_), @_; # uncoverable pod | ||||
317 | $rrtype = rand(255) + 65280 unless $rrtype; | ||||
318 | for ( typebyval $rrtype = int($rrtype) ) { | ||||
319 | croak "'$mnemonic' is a CLASS identifier" if $classbyname{$mnemonic}; | ||||
320 | return $rrtype if /^$mnemonic$/; # duplicate registration | ||||
321 | croak "'$mnemonic' conflicts with TYPE$rrtype ($_)" unless /^TYPE\d+$/; | ||||
322 | my $known = $typebyname{$mnemonic}; | ||||
323 | croak "'$mnemonic' conflicts with TYPE$known" if $known; | ||||
324 | } | ||||
325 | $typebyval{$rrtype} = $mnemonic; | ||||
326 | return $typebyname{$mnemonic} = $rrtype; | ||||
327 | } | ||||
328 | |||||
329 | |||||
330 | 2 | 365µs | 2 | 562µs | # spent 381µs (200+181) within Net::DNS::Parameters::BEGIN@330 which was called:
# once (200µs+181µs) by Net::DNS::RR::BEGIN@41 at line 330 # spent 381µs making 1 call to Net::DNS::Parameters::BEGIN@330
# spent 181µs making 1 call to constant::import # spent 132µs executing statements in string eval |
331 | |||||
332 | 1 | 2µs | our $DNSEXTLANG = EXTLANG ? eval 'Net::DNS::Extlang->new()->domain' : undef; | ||
333 | |||||
334 | sub _typespec { ## draft-levine-dnsextlang | ||||
335 | eval <<'END' if EXTLANG && $DNSEXTLANG; | ||||
336 | my ($node) = @_; | ||||
337 | |||||
338 | require Net::DNS::Resolver; | ||||
339 | my $resolver = new Net::DNS::Resolver() || return; | ||||
340 | my $response = $resolver->send( "$node.$DNSEXTLANG", 'TXT' ) || return; | ||||
341 | |||||
342 | foreach my $txt ( grep $_->type eq 'TXT', $response->answer ) { | ||||
343 | my @stanza = $txt->txtdata; | ||||
344 | my ( $tag, $identifier, @attribute ) = @stanza; | ||||
345 | next unless defined($tag) && $tag =~ /^RRTYPE=\d+$/; | ||||
346 | register( $1, $2 ) if $identifier =~ /^(\w+):(\d+)\W*/; | ||||
347 | return unless defined wantarray; | ||||
348 | |||||
349 | my $extobj = new Net::DNS::Extlang(); | ||||
350 | my $recipe = $extobj->xlstorerecord( $identifier, @attribute ); | ||||
351 | my @source = split /\n/, $extobj->compilerr($recipe); | ||||
352 | return sub { defined( $_ = shift @source ) }; | ||||
353 | } | ||||
354 | return; | ||||
355 | END | ||||
356 | } | ||||
357 | |||||
358 | |||||
359 | 1 | 115µs | 1; | ||
360 | __END__ | ||||
# spent 620µs within Net::DNS::Parameters::CORE:match which was called 274 times, avg 2µs/call:
# 170 times (379µs+0s) by Net::DNS::RR::BEGIN@41 at line 134, avg 2µs/call
# 42 times (94µs+0s) by Net::DNS::RR::BEGIN@41 at line 176, avg 2µs/call
# 28 times (63µs+0s) by Net::DNS::RR::BEGIN@41 at line 198, avg 2µs/call
# 12 times (29µs+0s) by Net::DNS::RR::BEGIN@41 at line 211, avg 2µs/call
# 10 times (26µs+0s) by Net::DNS::RR::BEGIN@41 at line 41, avg 3µs/call
# 10 times (24µs+0s) by Net::DNS::RR::BEGIN@41 at line 147, avg 2µs/call
# 2 times (5µs+0s) by Net::DNS::RR::BEGIN@41 at line 219, avg 3µs/call |