line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# Copyright (c) 1998-2009 Graham Barr . 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
|
|
|
|
|
|
|
our $VERSION = '0.24'; |
8
|
|
|
|
|
|
|
|
9
|
26
|
|
|
26
|
|
56542
|
use Exporter qw(import); |
|
26
|
|
|
|
|
58
|
|
|
26
|
|
|
|
|
15250
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
my @err2name; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
local $_; |
14
|
|
|
|
|
|
|
while () { |
15
|
|
|
|
|
|
|
last if /^=cut/; |
16
|
|
|
|
|
|
|
my $protocol_const = /^=head2 Protocol Constants/ ... /^=head2/; |
17
|
|
|
|
|
|
|
next unless /^=item\s+(LDAP_\S+)\s+\((.*)\)/; |
18
|
|
|
|
|
|
|
my ($name, $value) = ($1, $2); |
19
|
|
|
|
|
|
|
*{$name} = sub () { $value }; |
20
|
|
|
|
|
|
|
push @EXPORT_OK, $name; |
21
|
|
|
|
|
|
|
push @{$EXPORT_TAGS{codes}}, $name if $protocol_const; |
22
|
|
|
|
|
|
|
push @{$EXPORT_TAGS{controls}}, $name if ($name =~ /^LDAP_CONTROL_/); |
23
|
|
|
|
|
|
|
push @{$EXPORT_TAGS{features}}, $name if ($name =~ /^LDAP_FEATURE_/); |
24
|
|
|
|
|
|
|
push @{$EXPORT_TAGS{extensions}}, $name if ($name =~ /^LDAP_EXTENSION_/); |
25
|
|
|
|
|
|
|
push @{$EXPORT_TAGS{capabilities}}, $name if ($name =~ /^LDAP_CAP_/); |
26
|
|
|
|
|
|
|
$err2name[$value] = $name if $protocol_const; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
# These subs are really in Net::LDAP::Util, but need to access |
31
|
|
|
|
|
|
|
# so its easier for them to be here. |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub Net::LDAP::Util::ldap_error_name { |
35
|
98
|
50
|
|
98
|
1
|
22659
|
my $code = 0 + (ref($_[0]) ? $_[0]->code : $_[0]); |
36
|
|
|
|
|
|
|
|
37
|
98
|
100
|
|
|
|
382
|
$err2name[$code] || sprintf('LDAP error code %d(0x%02X)', $code, $code); |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub Net::LDAP::Util::ldap_error_text { |
42
|
0
|
0
|
|
0
|
1
|
|
my $code = 0 + (ref($_[0]) ? $_[0]->code : $_[0]); |
43
|
0
|
|
|
|
|
|
my $text; |
44
|
|
|
|
|
|
|
|
45
|
0
|
|
|
|
|
|
seek(DATA, 0, 0); |
46
|
0
|
|
|
|
|
|
local $/=''; # paragraph mode |
47
|
0
|
|
|
|
|
|
local $_; |
48
|
0
|
|
|
|
|
|
my $n = -1; |
49
|
0
|
|
|
|
|
|
while () { |
50
|
0
|
0
|
0
|
|
|
|
last if /^=head2/ and ++$n; |
51
|
0
|
0
|
|
|
|
|
last if /^=cut/; |
52
|
0
|
0
|
|
|
|
|
next if $n; |
53
|
0
|
0
|
|
|
|
|
if (/^=item\s+(LDAP_\S+)\s+\((\d+)\)/) { |
|
|
0
|
|
|
|
|
|
54
|
0
|
0
|
|
|
|
|
last if defined $text; |
55
|
0
|
0
|
|
|
|
|
$text = '' if $2 == $code; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
elsif (defined $text) { |
58
|
0
|
|
|
|
|
|
$text .= $_; |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
0
|
0
|
|
|
|
|
if (defined $text) { |
63
|
|
|
|
|
|
|
# Do some cleanup. Really should use a proper pod parser here. |
64
|
|
|
|
|
|
|
|
65
|
0
|
|
|
|
|
|
$text =~ s/^=item\s+\*\s+/ * /msg; |
66
|
0
|
|
|
|
|
|
$text =~ s/^=(over\s*\d*|back)//msg; |
67
|
0
|
|
|
|
|
|
$text =~ s/ +\n//g; |
68
|
0
|
|
|
|
|
|
$text =~ s/\n\n+/\n\n/g; |
69
|
0
|
0
|
|
|
|
|
$text =~ s/\n+\Z/\n/ if defined $text; |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
0
|
|
|
|
|
|
return $text; |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
1; |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
__DATA__ |