← Index
NYTProf Performance Profile   « line view »
For /usr/local/bin/sa-learn
  Run on Tue Nov 7 05:38:10 2017
Reported on Tue Nov 7 06:16:06 2017

Filename/usr/local/lib/perl5/site_perl/Net/DNS/RR/AAAA.pm
StatementsExecuted 10 statements in 1.22ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
11157µs66µsNet::DNS::RR::AAAA::::BEGIN@9Net::DNS::RR::AAAA::BEGIN@9
11134µs64µsNet::DNS::RR::AAAA::::BEGIN@10Net::DNS::RR::AAAA::BEGIN@10
11131µs36µsNet::DNS::RR::AAAA::::BEGIN@20Net::DNS::RR::AAAA::BEGIN@20
11124µs288µsNet::DNS::RR::AAAA::::BEGIN@11Net::DNS::RR::AAAA::BEGIN@11
0000s0sNet::DNS::RR::AAAA::::_decode_rdataNet::DNS::RR::AAAA::_decode_rdata
0000s0sNet::DNS::RR::AAAA::::_encode_rdataNet::DNS::RR::AAAA::_encode_rdata
0000s0sNet::DNS::RR::AAAA::::_format_rdataNet::DNS::RR::AAAA::_format_rdata
0000s0sNet::DNS::RR::AAAA::::_parse_rdataNet::DNS::RR::AAAA::_parse_rdata
0000s0sNet::DNS::RR::AAAA::::addressNet::DNS::RR::AAAA::address
0000s0sNet::DNS::RR::AAAA::::address_longNet::DNS::RR::AAAA::address_long
0000s0sNet::DNS::RR::AAAA::::address_shortNet::DNS::RR::AAAA::address_short
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package Net::DNS::RR::AAAA;
2
3#
4# $Id: AAAA.pm 1597 2017-09-22 08:04:02Z willem $
5#
612µsour $VERSION = (qw$LastChangedRevision: 1597 $)[1];
7
8
9274µs274µs
# spent 66µs (57+8) within Net::DNS::RR::AAAA::BEGIN@9 which was called: # once (57µs+8µs) by Net::DNS::RR::OPT::CLIENT_SUBNET::BEGIN@241 at line 9
use strict;
# spent 66µs making 1 call to Net::DNS::RR::AAAA::BEGIN@9 # spent 8µs making 1 call to strict::import
10272µs294µs
# spent 64µs (34+30) within Net::DNS::RR::AAAA::BEGIN@10 which was called: # once (34µs+30µs) by Net::DNS::RR::OPT::CLIENT_SUBNET::BEGIN@241 at line 10
use warnings;
# spent 64µs making 1 call to Net::DNS::RR::AAAA::BEGIN@10 # spent 30µs making 1 call to warnings::import
11281µs2552µs
# spent 288µs (24+264) within Net::DNS::RR::AAAA::BEGIN@11 which was called: # once (24µs+264µs) by Net::DNS::RR::OPT::CLIENT_SUBNET::BEGIN@241 at line 11
use base qw(Net::DNS::RR);
# spent 288µs making 1 call to Net::DNS::RR::AAAA::BEGIN@11 # spent 264µs making 1 call to base::import
12
13=head1 NAME
14
15Net::DNS::RR::AAAA - DNS AAAA resource record
16
17=cut
18
19
202978µs241µs
# spent 36µs (31+5) within Net::DNS::RR::AAAA::BEGIN@20 which was called: # once (31µs+5µs) by Net::DNS::RR::OPT::CLIENT_SUBNET::BEGIN@241 at line 20
use integer;
# spent 36µs making 1 call to Net::DNS::RR::AAAA::BEGIN@20 # spent 5µs making 1 call to integer::import
21
22
23sub _decode_rdata { ## decode rdata from wire-format octet string
24 my $self = shift;
25 my ( $data, $offset ) = @_;
26
27 $self->{address} = unpack "\@$offset a16", $$data;
28}
29
30
31sub _encode_rdata { ## encode rdata as wire-format octet string
32 my $self = shift;
33
34 pack 'a16', $self->{address};
35}
36
37
38sub _format_rdata { ## format rdata portion of RR string.
39 my $self = shift;
40
41 $self->address_short;
42}
43
44
45sub _parse_rdata { ## populate RR from rdata in argument list
46 my $self = shift;
47
48 $self->address(shift);
49}
50
51
52sub address_long {
53 my $addr = pack 'a*@16', grep defined, shift->{address};
54 sprintf '%x:%x:%x:%x:%x:%x:%x:%x', unpack 'n8', $addr;
55}
56
57
58sub address_short {
59 my $addr = pack 'a*@16', grep defined, shift->{address};
60 for ( sprintf ':%x:%x:%x:%x:%x:%x:%x:%x:', unpack 'n8', $addr ) {
61 s/(:0[:0]+:)(?!.+:0\1)/::/; # squash longest zero sequence
62 s/^:// unless /^::/; # prune LH :
63 s/:$// unless /::$/; # prune RH :
64 return $_;
65 }
66}
67
68
69sub address {
70 my $self = shift;
71
72 return address_long($self) unless scalar @_;
73
74 my $addr = shift;
75 my @parse = split /:/, "0$addr";
76
77 if ( (@parse)[$#parse] =~ /\./ ) { # embedded IPv4
78 my @ip4 = split /\./, pop(@parse);
79 my $rhs = pop(@ip4);
80 my @ip6 = map { /./ ? hex($_) : (0) x ( 7 - @parse ) } @parse;
81 return $self->{address} = pack 'n6 C4', @ip6, @ip4, (0) x ( 3 - @ip4 ), $rhs;
82 }
83
84 # Note: pack() masks overlarge values, mostly without warning.
85 my @expand = map { /./ ? hex($_) : (0) x ( 9 - @parse ) } @parse;
86 $self->{address} = pack 'n8', @expand;
87}
88
89
9018µs1;
91__END__