1# Copyright (c) 1998 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 5package URI::ldap; 6 7use strict; 8 9use vars qw(@ISA $VERSION); 10$VERSION = "1.11"; 11 12require URI::_server; 13require URI::_ldap; 14@ISA=qw(URI::_ldap URI::_server); 15 16sub default_port { 389 } 17 18sub _nonldap_canonical { 19 my $self = shift; 20 $self->URI::_server::canonical(@_); 21} 22 231; 24 25__END__ 26 27=head1 NAME 28 29URI::ldap - LDAP Uniform Resource Locators 30 31=head1 SYNOPSIS 32 33 use URI; 34 35 $uri = URI->new("ldap:$uri_string"); 36 $dn = $uri->dn; 37 $filter = $uri->filter; 38 @attr = $uri->attributes; 39 $scope = $uri->scope; 40 %extn = $uri->extensions; 41 42 $uri = URI->new("ldap:"); # start empty 43 $uri->host("ldap.itd.umich.edu"); 44 $uri->dn("o=University of Michigan,c=US"); 45 $uri->attributes(qw(postalAddress)); 46 $uri->scope('sub'); 47 $uri->filter('(cn=Babs Jensen)'); 48 print $uri->as_string,"\n"; 49 50=head1 DESCRIPTION 51 52C<URI::ldap> provides an interface to parse an LDAP URI into its 53constituent parts and also to build a URI as described in 54RFC 2255. 55 56=head1 METHODS 57 58C<URI::ldap> supports all the generic and server methods defined by 59L<URI>, plus the following. 60 61Each of the following methods can be used to set or get the value in 62the URI. The values are passed in unescaped form. None of these 63return undefined values, but elements without a default can be empty. 64If arguments are given, then a new value is set for the given part 65of the URI. 66 67=over 4 68 69=item $uri->dn( [$new_dn] ) 70 71Sets or gets the I<Distinguished Name> part of the URI. The DN 72identifies the base object of the LDAP search. 73 74=item $uri->attributes( [@new_attrs] ) 75 76Sets or gets the list of attribute names which are 77returned by the search. 78 79=item $uri->scope( [$new_scope] ) 80 81Sets or gets the scope to be used by the search. The value can be one of 82C<"base">, C<"one"> or C<"sub">. If none is given in the URI then the 83return value defaults to C<"base">. 84 85=item $uri->_scope( [$new_scope] ) 86 87Same as scope(), but does not default to anything. 88 89=item $uri->filter( [$new_filter] ) 90 91Sets or gets the filter to be used by the search. If none is given in 92the URI then the return value defaults to C<"(objectClass=*)">. 93 94=item $uri->_filter( [$new_filter] ) 95 96Same as filter(), but does not default to anything. 97 98=item $uri->extensions( [$etype => $evalue,...] ) 99 100Sets or gets the extensions used for the search. The list passed should 101be in the form etype1 => evalue1, etype2 => evalue2,... This is also 102the form of list that is returned. 103 104=back 105 106=head1 SEE ALSO 107 108L<RFC-2255|http://www.cis.ohio-state.edu/htbin/rfc/rfc2255.html> 109 110=head1 AUTHOR 111 112Graham Barr E<lt>F<gbarr@pobox.com>E<gt> 113 114Slightly modified by Gisle Aas to fit into the URI distribution. 115 116=head1 COPYRIGHT 117 118Copyright (c) 1998 Graham Barr. All rights reserved. This program is 119free software; you can redistribute it and/or modify it under the same 120terms as Perl itself. 121 122=cut 123