1Net::LDAP::Filter(3) User Contributed Perl Documentation Net::LDAP::Filter(3)
2
3
4
6 Net::LDAP::Filter - representation of LDAP filters
7
9 use Net::LDAP::Filter;
10
11 $filter = Net::LDAP::Filter->new( $filter_str );
12
14 The Net::LDAP::Filter object lets you directly manipulate LDAP filters
15 without worrying about the string representation and all the associated
16 escaping mechanisms.
17
19 new ( [ FILTER ] )
20 Create a new object. If FILTER is given, parse it.
21
23 parse ( FILTER )
24 Parse FILTER, updating the object to represent it.
25
26 as_string
27 Return the filter in text form.
28
29 print ( [ FH ] )
30 Print the text representation of the filter to FH, or the currently
31 selected output handle if FH is not given.
32
33 negate ( )
34 Logically negate/invert the filter object so that it matches the
35 opposite set of entries as the original.
36
37 Instead of simply negating the text form by surrounding it with the
38 not operator, the negation is done by recursively applying De
39 Morgan's law.
40
41 Here is an example:
42
43 (|(&(cn=A)(cn=B))(|(!(cn=C))(cn=D)))
44
45 gets negated to
46
47 (&(|(!(cn=A))(!(cn=B)))(&(cn=C)(!(cn=D))))
48
50 Below is the syntax for a filter given in RFC 4515
51 http://www.ietf.org/rfc/rfc4515.txt
52
53 filter = "(" filtercomp ")"
54 filtercomp = and / or / not / item
55 and = "&" filterlist
56 or = "|" filterlist
57 not = "!" filter
58 filterlist = 1*filter
59 item = simple / present / substring / extensible
60 simple = attr filtertype value
61 filtertype = equal / approx / greater / less
62 equal = "="
63 approx = "~="
64 greater = ">="
65 less = "<="
66 extensible = attr [":dn"] [":" matchingrule] ":=" value
67 / [":dn"] ":" matchingrule ":=" value
68 present = attr "=*"
69 substring = attr "=" [initial] any [final]
70 initial = value
71 any = "*" *(value "*")
72 final = value
73 attr = AttributeDescription from Section 4.1.4 of RFC 4511
74 matchingrule = MatchingRuleId from Section 4.1.8 of RFC 4511
75 value = AttributeValue from Section 4.1.5 of RFC 4511
76
77
78 Special Character encodings
79 ---------------------------
80 * \2a, \*
81 ( \28, \(
82 ) \29, \)
83 \ \5c, \\
84 NUL \00
85
87 Net::LDAP, Other online documentation
88
90 This document is based on a document originally written by Russell
91 Fulton <r.fulton@auckland.ac.nz>.
92
94 Graham Barr <gbarr@pobox.com>
95
96 Please report any bugs, or post any suggestions, to the perl-ldap
97 mailing list <perl-ldap@perl.org>.
98
100 Copyright (c) 1997-2004 Graham Barr. All rights reserved. This program
101 is free software; you can redistribute it and/or modify it under the
102 same terms as Perl itself.
103
104
105
106perl v5.36.0 2022-07-22 Net::LDAP::Filter(3)