Net::LDAP::Schema(3)
π NAME π
Net::LDAP::Schema β load and manipulate an LDAP v3 Schema. Yes bestie, this is the Net::LDAP::Schema(3) page, and it's lowkey here to help you load an LDAP schema and then query it. π¦
β¨ SYNOPSIS β¨
Okay so first up, the vibe check: use the modules, then either read the schema straight from the server or load it from LDIF. Behold:
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;
Slay. π
πΈ DESCRIPTION πΈ
Net::LDAP::Schema provides a means to load an LDAP schema and query it for information regarding supported objectclasses, attributes and syntaxes. That's the whole elevator pitch, bestie β iconic behavior. β¨
π METHODS π
Okay, method time. 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.
Each returned item of schema (e.g. an attribute definition) is returned in a HASH. The keys in the returned HASH are lowercase versions of the keys read from the server. Here's a partial list (not all HASHes define all keys) although note that RFC 4512 permits other keys as well:
name
desc
obsolete
sup
equality
ordering
substr
syntax
single-value
collective
no-user-modification
usage
abstract
structural
auxiliary
must
may
applies
aux
not
oc
form
β¨ The all_* squad β¨
These all return a list of all the requested types in the schema:
all_attributes ( )all_ditcontentrules ( )all_ditstructurerules ( )all_matchingrules ( )all_matchingruleuses ( )all_nameforms ( )all_objectclasses ( )all_syntaxes ( )
π Single-item lookups π
These return a reference to a hash, or undef if the schema item does not exist. NAME can be a name or an OID.
attribute ( NAME )ditcontentrule ( NAME )ditstructurerule ( NAME )matchingrule ( NAME )matchingruleuse ( NAME )nameform ( NAME )objectclass ( NAME )syntax ( NAME )
Example:
$attr_href = $schema->attribute( "attrname" );
πΎ Dump it πΎ
dump ( )β dump the raw schema information to standard out.dump ( FILENAME )β dump the raw schema information to a file.
$result = $schema->dump ( "./schema.dump" );
If no schema data is returned from directory server, the method will return undefined. Otherwise a value of 1 is always returned.
error ( )β returns the last error encountered when parsing the schema.
π«Ά Objectclass helpers π«Ά
may ( OBJECTCLASS )β given an argument which is the name or OID of a known object class, returns a list ofHASHes describing the attributes which are optional in the class.
@may = $schema->may ( $oc );
# First optional attr has the name '$may[0]->{name}'
must ( OBJECTCLASS )β given an argument which is the name or OID of a known object class, returns a list ofHASHes describing the attributes which are mandatory in the class.
@must = $schema->must ( $oc );
superclass ( NAME )β given an argument which is the name or OID of a known objectclass, returns the list of names of the immediate superclasses.
π§ Parsing & syntax helpers π§
parse ( MESG ),parse ( ENTRY ),parse ( FILENAME )β takes a single argument which can be any of: a message object returned from an LDAP search, aNet::LDAP::Entryobject, 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 undef on error.
attribute_syntax ( NAME )β given an attribute name, return the actual syntax taking into account attribute supertypes.matchingrule_for_attribute ( NAME, RULE )β given an attribute name and a matching rule ("equality","substr", etc), return the actual rule taking into account attribute supertypes.
π SEE ALSO π
Net::LDAPNet::LDAP::RFC
π«Ά 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@perl.org>. π
π COPYRIGHT π
Copyright (c) 1998-2004 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.
π And that's the whole page, bestie β from perl v5.42.0, dated 2024-01-02. Net::LDAP::Schema(3) out! π
β¨
π¦ where this page comes from
- opensuse-leap 16.0: perl-ldap 0.68-160000.2.2 Β· Artistic-1.0 OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms