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