[ Index ] |
PHP Cross Reference of Unnamed Project |
[Summary view] [Print] [Text view]
1 # Copyright (c) 1999-2004 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::Control::SortResult; 6 7 use Net::LDAP::ASN qw(SortResult); 8 use Net::LDAP::Control; 9 10 $VERSION = "0.01"; 11 @ISA = qw(Net::LDAP::Control); 12 13 sub init { 14 my($self) = @_; 15 16 if (exists $self->{value}) { 17 $self->{asn} = $SortResult->decode(delete $self->{value}); 18 } 19 else { 20 $self->{asn} = { sortResult => delete $self->{result} }; 21 $self->{asn}{attributeType} = delete $self->{attr} if exists $self->{attr}; 22 } 23 24 $self; 25 } 26 27 sub value { 28 my $self = shift; 29 30 $self->{value} = $SortResult->encode($self->{asn}); 31 } 32 33 sub result { 34 my $self = shift; 35 36 @_ ? ($self->{asn}{sortResult}=shift) 37 : $self->{asn}{sortResult}; 38 } 39 40 sub attr { 41 my $self = shift; 42 43 @_ ? ($self->{asn}{attributeType}=shift) 44 : $self->{asn}{attributeType}; 45 } 46 47 1; 48 49 50 __END__ 51 52 53 =head1 NAME 54 55 Net::LDAP::Control::SortResult - Server Side Sort (SSS) result control object 56 57 =head1 SYNOPSIS 58 59 use Net::LDAP::Control::Sort; 60 use Net::LDAP::Constant qw(LDAP_CONTROL_SORTRESULT); 61 use Net::LDAP::Util qw(ldap_error_name); 62 63 $sort = Net::LDAP::Control::Sort->new( 64 order => "cn -age" 65 ); 66 67 $mesg = $ldap->search( @args, control => [ $sort ]); 68 69 ($resp) = $mesg->control( LDAP_CONTROL_SORTRESULT ); 70 71 if ($resp) { 72 if ($resp->result) { 73 my $attr = $resp->attr; 74 print "Problem sorting, ",ldap_error_name($resp->result); 75 print " ($attr)" if $attr; 76 print "\n"; 77 } 78 else { 79 print "Results are sorted\n"; 80 } 81 } 82 else { 83 print "Server does not support sorting\n"; 84 } 85 86 =head1 DESCRIPTION 87 88 C<Net::LDAP::Control::SortResult> is a sub-class of 89 L<Net::LDAP::Control>. It provides a class for 90 manipulating the LDAP sort request control C<1.2.840.113556.1.4.474> 91 as defined in RFC-2891 92 93 A sort result control will be returned by the server in response to 94 a search with a Server Side Sort control. If a sort result control is 95 not returned then the user may assume that the server does not support 96 sorting and the results are not sorted. 97 98 =head1 CONSTRUCTOR ARGUMENTS 99 100 =over 4 101 102 =item attr 103 104 If C<result> indicates that there was a problem with sorting and that problem was 105 due to one of the attributes specified in the sort control. C<attr> is set to 106 the name of the attribute causing the problem. 107 108 =item result 109 110 This is the result code that describes if the sort operation was sucessful. If will 111 be one of the result codes describes below. 112 113 =back 114 115 116 =head1 METHODS 117 118 As with L<Net::LDAP::Control> each constructor argument 119 described above is also avaliable as a method on the object which will 120 return the current value for the attribute if called without an argument, 121 and set a new value for the attribute if called with an argument. 122 123 =head1 RESULT CODES 124 125 Possible results from a sort request are listed below. See L<Net::LDAP::Constant> for 126 a definition of each. 127 128 =over 4 129 130 =item LDAP_SUCCESS 131 132 =item LDAP_OPERATIONS_ERROR 133 134 =item LDAP_TIMELIMIT_EXCEEDED 135 136 =item LDAP_STRONG_AUTH_REQUIRED 137 138 =item LDAP_ADMIN_LIMIT_EXCEEDED 139 140 =item LDAP_NO_SUCH_ATTRIBUTE 141 142 =item LDAP_INAPPROPRIATE_MATCHING 143 144 =item LDAP_INSUFFICIENT_ACCESS 145 146 =item LDAP_BUSY 147 148 =item LDAP_UNWILLING_TO_PERFORM 149 150 =item LDAP_OTHER 151 152 =back 153 154 =head1 SEE ALSO 155 156 L<Net::LDAP>, 157 L<Net::LDAP::Control::Sort>, 158 L<Net::LDAP::Control>, 159 http://ww.ietf.org/rfc/rfc2891.txt 160 161 =head1 AUTHOR 162 163 Graham Barr E<lt>gbarr@pobox.comE<gt> 164 165 Please report any bugs, or post any suggestions, to the perl-ldap mailing list 166 E<lt>perl-ldap@perl.orgE<gt> 167 168 =head1 COPYRIGHT 169 170 Copyright (c) 1999-2004 Graham Barr. All rights reserved. This program is 171 free software; you can redistribute it and/or modify it under the same 172 terms as Perl itself. 173 174 =cut
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 |