=head1 NAME

Net::LDAP::Schema - Load and manipulate an LDAP v3 Schema

=head1 SYNOPSIS

 use Net::LDAP;
 use Net::LDAP::Schema;

 #
 # Read schema from server
 #
 $ldap = Net::LDAP->new( $server );
 $ldap->bind();
 $schema = $ldap->schema();

 #
 # Load from LDIF
 #
 $schema = Net::LDAP::Schema->new;
 $schema->parse( "schema.ldif" ) or die $schema->error;

=head1 DESCRIPTION

B<Net::LDAP::Schema> provides a means to load an LDAP schema and query it
for information regarding supported objectclasses, attributes and syntaxes.

=head1 METHODS

Where a method is stated as taking the 'name or oid' of a schema item (which
may be an object class, attribute or syntax) then a case-insensitive name
or raw oid (object identifier, in dotted numeric string form, e.g. 2.5.4.0)
may be supplied.

=over 4

=item all_attributes

=item all_ditcontentrules

=item all_ditstructurerules

=item all_matchingrules

=item all_matchingruleuses

=item all_nameforms

=item all_objectclasses

=item all_syntaxes

Returns a list of the names all the requested type in the schema

  @attrs = $schema->all_attributes();

=item attribute NAME_OR_OID

=item ditcontentrule NAME_OR_OID

=item ditstructurerule NAME_OR_OID

=item matchingrule NAME_OR_OID

=item matchingruleuse NAME_OR_OID

=item nameform NAME_OR_OID

=item objectclass NAME_OR_OID

=item syntax NAME_OR_OID

Returns a reference to a hash, or undef if the attribute does not exist.

  $attr_href = $schema->attribute( "attrname" );

=item dump

=item dump FILENAME

Given an argument which is the name of a file, and the file or
directory has write permission, will dump the raw schema 
information to a file.  If no argument is given the raw schema 
information is dumped to standard out.

  $result = $schema->dump( "./schema.dump" );

  or

  $result = $schema->dump();

If no schema data is returned from directory server, the method
will return undefined.  Otherwise a value of 1 is always returned.

=item error

Returns the last error encountered.

Given the name or oid of a schema item (matchingruleuse, ditstructurerule, 
ditcontentrule or nameform respectively) returns the assoicated OID 
or undef if the name or oid is not of the appropriate type.

=item may

Given an argument which is the name or oid of a known object class, returns
the names of the attributes which are optional in the class.

  @may = $schema->may( $oc );

=item must

Given an argument which is the name or oid of a known object class, returns
the names of the attributes which are mandatory in the class

  @must = $schema->must( $oc );

=item parse MESG

=item parse ENTRY

=item parse FILENAME

Takes a single argument which can be any of, A message objected returned from
an LDAP search, a Net::LDAP::Entry object or the name of a file containing
an LDIF form of the schema.

If the argument is a message result from a search, Net::LDAP::Schema will parse
the schema from the first entry returned.

Returns true on success and C<undef> on error.

=item superclass

Given an argument which is the name or oid of a known objectclass, returns
the list of names of the immediate superclasses.

=back

=head1 SEE ALSO

L<Net::LDAP>,
L<Net::LDAP::RFC>

=head1 AUTHORS

Graham Barr <gbarr@pobox.com>
John Berthels <jjb@nexor.co.uk>

Please report any bugs, or post any suggestions, to the perl-ldap mailing list
<perl-ldap-dev@lists.sourceforge.net>.

=head1 COPYRIGHT

Copyright (c) 1998-2000 Graham Barr. All rights reserved. This program is
free software; you can redistribute it and/or modify it under the same
terms as Perl itself.

=for html <hr>

I<$Id: Schema.pod,v 1.11 2002/04/23 10:57:29 gbarr Exp $>

=cut
