Net::LDAP::Schema - Load and manipulate an LDAP v3 Schema
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->new; $schema->parse( "schema.ldif" ) or die $schema->error;
Net::LDAP::Schema provides a means to load an LDAP schema and query it for information regarding supported objectclasses, attributes and syntaxes.
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.
@atts = $schema->attributes();
If called with an argument which is the name or oid of a known object class, returns a list of the attributes which may (or must) be present in the OC.
@person_atts = $schema->attributes( "person" );
Return value is an array or array reference depending on calling context, or empty list on error.
$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.
# Is foo a known OC? $oid = $schema->is_objectclass( "foo" ); # No? Bale out. die( "Not an objectclass" ) unless $oid; # Yes...so we can do this @must = $schema->must( $oid );
@item = $schema->item( $oid, "desc" );
Return value is an array or a value depending on calling context.
@items = $schema->items( $oid );
Return value is an array or array reference depending on calling context.
@mrs = $schema->matchingrules();
Return value is an array or array reference depending on calling context.
@may = $schema->may( $oc );
Return value is an array or array reference depending on calling context.
@must = $schema->must( $oc );
Return value is an array or array reference depending on calling context.
@ocs = $schema->objectclasses();
Return value is an array or array reference depending on calling context.
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 undef
on error.
$name_syntax = $schema->syntax( "commonName" );
@syns = $schema->syntaxes();
Return value is an array or array reference depending on calling context.
Net::LDAP, Other online documentation
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>.
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.
$Id$