From: Chris R. <chr...@us...> - 2003-05-06 12:16:57
|
Update of /cvsroot/perl-ldap/ldap/lib/Net/LDAP In directory sc8-pr-cvs1:/tmp/cvs-serv2313/lib/Net/LDAP Modified Files: Examples.pod Log Message: Fixed schema examples Index: Examples.pod =================================================================== RCS file: /cvsroot/perl-ldap/ldap/lib/Net/LDAP/Examples.pod,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- Examples.pod 12 Sep 2000 09:17:09 -0000 1.4 +++ Examples.pod 6 May 2003 12:16:54 -0000 1.5 @@ -469,7 +469,7 @@ $mesg = $self->search( base => $dn, scope => 'base', - filter => '(objectClass=*)', + filter => '(objectClass=subschema)', ); Once the schema object has been initialized, schema methods @@ -484,56 +484,34 @@ # Get the attributes # - @attributes = $schema->attributes(); + @attributes = $schema->all_attributes(); # # Display the attributes # foreach ( @attributes) { - print "attributeType\n"; + print "attributeType $_\n"; # - # Get and display the oid number of the objectclass. + # Get a reference to the attribute details # - $oid = $schema->name2oid( "$_" ); + $ar = $schema->attribute( $_ ); # - # Get the various items associated with - # this attribute. - # - @attribute_items = $schema->items( "$oid" ); - # - # Read returned item names and display their associated data. + # Print all the details # - foreach $value ( @attribute_items ) + foreach $key ( keys $ar ) { - # We know we are dealing with an attribute, ignore type. - next if ( $value eq 'type'); # Type holds oc or at - # - # Read the data for this item of this oid. - # - @item = $schema->item( $oid, $value ); - # - # Some item names have no data, the name itself is data. - # This type of item has 1 as data. - # - if ( defined(@item) && $item[0] == 1 ) - { - print "\t$value\n"; - next; - } - if ( defined(@item) && $#item >= 0 ) - { - print "\t$value: @item\n"; - } - + print join("\n\t\t", "\t$key:", + ref($ar->{$key}) ? @{$ar->{$key}} : $ar->{$key}), + "\n"; } } The process is the basically the same for getting objectClass -information. Where schema->attributes() is used, substitute -schema->objectclasses(). From that point on the process is +information. Where schema->all_attributes() is used, substitute +schema->all_objectclasses(). From that point on the process is the same for both objectClasses and attributes. =head1 BUGS |