Filename | /usr/share/perl5/Net/LDAP/Constant.pm |
Statements | Executed 2048 statements in 6.40ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1564 | 3 | 1 | 747µs | 747µs | CORE:match (opcode) | Net::LDAP::Constant::
522 | 2 | 1 | 341µs | 341µs | CORE:readline (opcode) | Net::LDAP::Constant::
1 | 1 | 1 | 23µs | 34µs | BEGIN@9 | Net::LDAP::Constant::
0 | 0 | 0 | 0s | 0s | __ANON__[:19] | Net::LDAP::Constant::
0 | 0 | 0 | 0s | 0s | ldap_error_name | Net::LDAP::Util::
0 | 0 | 0 | 0s | 0s | ldap_error_text | Net::LDAP::Util::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | # Copyright (c) 1998-2009 Graham Barr <gbarr@pobox.com>. All rights reserved. | ||||
2 | # This program is free software; you can redistribute it and/or | ||||
3 | # modify it under the same terms as Perl itself. | ||||
4 | |||||
5 | package Net::LDAP::Constant; | ||||
6 | |||||
7 | 1 | 600ns | $VERSION = "0.08"; | ||
8 | |||||
9 | 3 | 408µs | 2 | 45µs | # spent 34µs (23+11) within Net::LDAP::Constant::BEGIN@9 which was called:
# once (23µs+11µs) by Net::LDAP::Message::BEGIN@7 at line 9 # spent 34µs making 1 call to Net::LDAP::Constant::BEGIN@9
# spent 11µs making 1 call to Exporter::import |
10 | |||||
11 | 1 | 300ns | my @err2name; | ||
12 | |||||
13 | 1 | 400ns | local $_; | ||
14 | 1 | 895µs | 403 | 235µs | while(<DATA>) { # spent 235µs making 403 calls to Net::LDAP::Constant::CORE:readline, avg 584ns/call |
15 | 522 | 911µs | 522 | 194µs | last if /^=cut/; # spent 194µs making 522 calls to Net::LDAP::Constant::CORE:match, avg 372ns/call |
16 | 521 | 1.04ms | 521 | 149µs | my $protocol_const = /^=head2 Protocol Constants/ ... /^=head2/; # spent 149µs making 521 calls to Net::LDAP::Constant::CORE:match, avg 286ns/call |
17 | 521 | 1.31ms | 521 | 404µs | next unless /^=item\s+(LDAP_\S+)\s+\((.*)\)/; # spent 404µs making 521 calls to Net::LDAP::Constant::CORE:match, avg 776ns/call |
18 | 119 | 197µs | my ($name, $value) = ($1,$2); | ||
19 | 119 | 986µs | *{$name} = sub () { $value }; | ||
20 | 119 | 91µs | push @EXPORT_OK, $name; | ||
21 | 119 | 552µs | 119 | 106µs | $err2name[$value] = $name if $protocol_const; # spent 106µs making 119 calls to Net::LDAP::Constant::CORE:readline, avg 892ns/call |
22 | } | ||||
23 | |||||
24 | |||||
25 | # These subs are really in Net::LDAP::Util, but need to access <DATA> | ||||
26 | # so its easier for them to be here. | ||||
27 | |||||
28 | |||||
29 | sub Net::LDAP::Util::ldap_error_name { | ||||
30 | my $code = 0 + (ref($_[0]) ? $_[0]->code : $_[0]); | ||||
31 | |||||
32 | $err2name[$code] || sprintf("LDAP error code %d(0x%02X)",$code,$code); | ||||
33 | } | ||||
34 | |||||
35 | |||||
36 | sub Net::LDAP::Util::ldap_error_text { | ||||
37 | my $code = 0 + (ref($_[0]) ? $_[0]->code : $_[0]); | ||||
38 | my $text; | ||||
39 | |||||
40 | seek(DATA,0,0); | ||||
41 | local $/=''; # paragraph mode | ||||
42 | local $_; | ||||
43 | my $n = -1; | ||||
44 | while(<DATA>) { | ||||
45 | last if /^=head2/ and ++$n; | ||||
46 | last if /^=cut/; | ||||
47 | next if $n; | ||||
48 | if (/^=item\s+(LDAP_\S+)\s+\((\d+)\)/) { | ||||
49 | last if defined $text; | ||||
50 | $text = '' if $2 == $code; | ||||
51 | } | ||||
52 | elsif (defined $text) { | ||||
53 | $text .= $_; | ||||
54 | } | ||||
55 | } | ||||
56 | |||||
57 | if (defined $text) { | ||||
58 | # Do some cleanup. Really should use a proper pod parser here. | ||||
59 | |||||
60 | $text =~ s/^=item\s+\*\s+/ * /msg; | ||||
61 | $text =~ s/^=(over\s*\d*|back)//msg; | ||||
62 | $text =~ s/ +\n//g; | ||||
63 | $text =~ s/\n\n+/\n\n/g; | ||||
64 | $text =~ s/\n+\Z/\n/ if defined $text; | ||||
65 | } | ||||
66 | |||||
67 | return $text; | ||||
68 | } | ||||
69 | |||||
70 | 1 | 17µs | 1; | ||
71 | |||||
72 | __DATA__ | ||||
# spent 747µs within Net::LDAP::Constant::CORE:match which was called 1564 times, avg 478ns/call:
# 522 times (194µs+0s) by Net::LDAP::Message::BEGIN@7 at line 15, avg 372ns/call
# 521 times (404µs+0s) by Net::LDAP::Message::BEGIN@7 at line 17, avg 776ns/call
# 521 times (149µs+0s) by Net::LDAP::Message::BEGIN@7 at line 16, avg 286ns/call | |||||
sub Net::LDAP::Constant::CORE:readline; # opcode |