| Filename | /usr/share/perl5/Net/LDAP/Constant.pm |
| Statements | Executed 2048 statements in 8.39ms |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 1564 | 3 | 1 | 1.07ms | 1.07ms | Net::LDAP::Constant::CORE:match (opcode) |
| 522 | 2 | 1 | 472µs | 472µs | Net::LDAP::Constant::CORE:readline (opcode) |
| 1 | 1 | 1 | 28µs | 40µs | Net::LDAP::Constant::BEGIN@9 |
| 0 | 0 | 0 | 0s | 0s | Net::LDAP::Constant::__ANON__[:19] |
| 0 | 0 | 0 | 0s | 0s | Net::LDAP::Util::ldap_error_name |
| 0 | 0 | 0 | 0s | 0s | Net::LDAP::Util::ldap_error_text |
| 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 | 409µs | 2 | 51µs | # spent 40µs (28+12) within Net::LDAP::Constant::BEGIN@9 which was called:
# once (28µs+12µs) by Net::LDAP::Message::BEGIN@7 at line 9 # spent 40µs making 1 call to Net::LDAP::Constant::BEGIN@9
# spent 12µs making 1 call to Exporter::import |
| 10 | |||||
| 11 | 1 | 300ns | my @err2name; | ||
| 12 | |||||
| 13 | 1 | 300ns | local $_; | ||
| 14 | 1 | 14µs | 403 | 315µs | while(<DATA>) { # spent 315µs making 403 calls to Net::LDAP::Constant::CORE:readline, avg 782ns/call |
| 15 | 2040 | 7.95ms | 522 | 303µs | last if /^=cut/; # spent 303µs making 522 calls to Net::LDAP::Constant::CORE:match, avg 580ns/call |
| 16 | 521 | 188µs | my $protocol_const = /^=head2 Protocol Constants/ ... /^=head2/; # spent 188µs making 521 calls to Net::LDAP::Constant::CORE:match, avg 361ns/call | ||
| 17 | 521 | 574µs | next unless /^=item\s+(LDAP_\S+)\s+\((.*)\)/; # spent 574µs making 521 calls to Net::LDAP::Constant::CORE:match, avg 1µs/call | ||
| 18 | my ($name, $value) = ($1,$2); | ||||
| 19 | *{$name} = sub () { $value }; | ||||
| 20 | push @EXPORT_OK, $name; | ||||
| 21 | 119 | 157µs | $err2name[$value] = $name if $protocol_const; # spent 157µs making 119 calls to Net::LDAP::Constant::CORE:readline, avg 1µs/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 | 24µs | 1; | ||
| 71 | |||||
| 72 | __DATA__ | ||||
# spent 1.07ms within Net::LDAP::Constant::CORE:match which was called 1564 times, avg 681ns/call:
# 522 times (303µs+0s) by Net::LDAP::Message::BEGIN@7 at line 15, avg 580ns/call
# 521 times (574µs+0s) by Net::LDAP::Message::BEGIN@7 at line 17, avg 1µs/call
# 521 times (188µs+0s) by Net::LDAP::Message::BEGIN@7 at line 16, avg 361ns/call | |||||
sub Net::LDAP::Constant::CORE:readline; # opcode |