[ Index ] |
PHP Cross Reference of Unnamed Project |
[Summary view] [Print] [Text view]
1 # Copyright (c) 2004 Peter Marschall <peter@adpm.de>. 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::Control::PersistentSearch; 6 7 use vars qw(@ISA $VERSION); 8 use Net::LDAP::Control; 9 10 @ISA = qw(Net::LDAP::Control); 11 $VERSION = "0.01"; 12 13 use Net::LDAP::ASN qw(PersistentSearch); 14 use strict; 15 16 sub init { 17 my($self) = @_; 18 19 delete $self->{asn}; 20 21 unless (exists $self->{value}) { 22 $self->{asn} = { 23 changeTypes => $self->{changeTypes} || '15', 24 changesOnly => $self->{changesOnly} || '0', 25 returnECs => $self->{returnECs} || '0', 26 }; 27 } 28 29 $self; 30 } 31 32 sub changeTypes { 33 my $self = shift; 34 $self->{asn} ||= $PersistentSearch->decode($self->{value}); 35 if (@_) { 36 delete $self->{value}; 37 return $self->{asn}{changeTypes} = shift || 0; 38 } 39 $self->{asn}{changeTypes}; 40 } 41 42 sub changesOnly { 43 my $self = shift; 44 $self->{asn} ||= $PersistentSearch->decode($self->{value}); 45 if (@_) { 46 delete $self->{value}; 47 return $self->{asn}{changesOnly} = shift || 0; 48 } 49 $self->{asn}{changesOnly}; 50 } 51 52 sub returnECs { 53 my $self = shift; 54 $self->{asn} ||= $PersistentSearch->decode($self->{value}); 55 if (@_) { 56 delete $self->{value}; 57 return $self->{asn}{returnECs} = shift || 0; 58 } 59 $self->{asn}{returnECs}; 60 } 61 62 sub value { 63 my $self = shift; 64 65 exists $self->{value} 66 ? $self->{value} 67 : $self->{value} = $PersistentSearch->encode($self->{asn}); 68 } 69 70 1; 71 72 __END__ 73 74 =head1 NAME 75 76 Net::LDAP::Control::PersistentSearch - LDAPv3 Persistent Search control object 77 78 =head1 SYNOPSIS 79 80 use Net::LDAP; 81 use Net::LDAP::Control::PersistentSearch; 82 83 $ldap = Net::LDAP->new( "ldap.mydomain.eg" ); 84 85 $persist = Net::LDAP::Control::PersistentSearch->new( changeTypes => 15, 86 changesOnly => 1, 87 returnECs => 1 ); 88 89 $srch = $ldap->search( base => "cn=People,dc=mydomain,dc=eg", 90 filter => "(objectClass=person)", 91 callback => \&process_entry, # call for each entry 92 control => [ $persist ] ); 93 94 die "error: ",$srch->code(),": ",$srch->error() if ($srch->code()); 95 96 sub process_entry { 97 my $message = shift; 98 my $entry = shift; 99 100 print $entry->dn()."\n"; 101 } 102 103 104 =head1 DESCRIPTION 105 106 C<Net::LDAP::Control::PersistentSearch> provides an interface for the creation 107 and manipulation of objects that represent the C<PersistentSearch> control as 108 described by draft-smith-psearch-ldap-01.txt. 109 110 =head1 CONSTRUCTOR ARGUMENTS 111 112 In addition to the constructor arguments described in 113 L<Net::LDAP::Control> the following are provided. 114 115 =over 4 116 117 =item changeTypes 118 119 An integer value determining the types of changes to look out for. 120 It is the bitwise OR of the following values (which represent the LDAP 121 operations indicated next to them): 122 123 =over 4 124 125 =item 1 = add 126 127 =item 2 = delete 128 129 =item 4 = modify 130 131 =item 8 = modDN 132 133 =back 134 135 If it is not given it defaults to 15 meaning all changes. 136 137 =item changesOnly 138 139 A boolean value telling whether the server may return 140 entries that match the search criteria. 141 142 If C<TRUE> the server must not return return any existing 143 entries that match the search criteria. Entries are only 144 returned when they are changed (added, modified, deleted, or 145 subject to a modifyDN operation) 146 147 =item returnECs 148 149 If C<TRUE>, the server must return an Entry Change Notification 150 control with each entry returned as the result of changes. 151 152 See L<Net::LDAP::Control::EntryChange> for details. 153 154 =back 155 156 =head1 METHODS 157 158 As with L<Net::LDAP::Control> each constructor argument 159 described above is also available as a method on the object which will 160 return the current value for the attribute if called without an argument, 161 and set a new value for the attribute if called with an argument. 162 163 =head1 SEE ALSO 164 165 L<Net::LDAP>, 166 L<Net::LDAP::Control>, 167 L<Net::LDAP::Control::EntryChange> 168 169 =head1 AUTHOR 170 171 Peter Marschall E<lt>peter@adpm.deE<gt>, based on Net::LDAP::Control::Page 172 from Graham Barr E<lt>gbarr@pobox.comE<gt> and the preparatory work 173 of Don Miller E<lt>donm@uidaho.eduE<gt>. 174 175 Please report any bugs, or post any suggestions, to the perl-ldap 176 mailing list E<lt>perl-ldap@perl.orgE<gt> 177 178 =head1 COPYRIGHT 179 180 Copyright (c) 2004 Peter Marschall. All rights reserved. This program is 181 free software; you can redistribute it and/or modify it under the same 182 terms as Perl itself. 183 184 =cut 185
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Tue Mar 17 22:47:18 2015 | Cross-referenced by PHPXref 0.7.1 |