The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Net::LDAP::DSML -- A DSML Writer and Reader for Net::LDAP

SYNOPSIS

 use Net::LDAP;
 use Net::LDAP::DSML;
 use IO::File;


 my $server = "localhost";
 my $file = "testdsml.xml";
 my $ldap = Net::LDAP->new($server);
 
 $ldap->bind();

 my $dsml = Net::LDAP::DSML->new();

 my $file = "testdsml.xml";

 my $io = IO::File->new($file,"w") or die ("failed to open $file as filehandle.$!\n");
 $dsml->open($io) or die ("DSML problems opening $file.$!\n"); ;

 #or

 open (IO,">$file") or die("failed to open $file.$!");

 $dsml->open(*IO) or die ("DSML problems opening $file.$!\n");

  my $mesg = $ldap->search(
                           base     => 'o=airius.com',
                           scope    => 'sub',
                           filter   => 'ou=accounting',
                           callback => sub {
                                         my ($mesg,$entry) =@_;
                                         $dsml->write($entry) if (ref $entry eq 'Net::LDAP::Entry');
                                       }
                            );  

 die ("search failed with ",$mesg->code(),"\n") if $mesg->code();

 $dsml->write($schema);
 $dsml->finish();

 print "Finished printing DSML\n";
 print "Starting to process DSML\n";

 $dsml = new Net::LDAP::DSML();
 $dsml->process($file, entry => \&processEntry);

 #future when schema support is available will be
 #$dsml->process($file, entry => \&processEntry, schema => \&processSchema);

 sub processEntry {
   my $entry = shift;
  
   $entry->dump();
 } 

DESCRIPTION

Directory Service Markup Language (DSML) is the XML standard for representing directory service information in XML.

At the moment this module only reads and writes DSML entry entities. It cannot process any schema entities because schema entities are processed differently than elements.

Eventually this module will be a full level 2 consumer and producer enabling you to give you full DSML conformance.

The module uses callbacks to improve performance (at least the appearance of improving performance ;) and to reduce the amount of memory required to parse large DSML files. Every time a single entry or schema is processed we pass the Net::LDAP object (either an Entry or Schema object) to the callback routine.

AUTHOR

Mark Wilcox mark@mwjilcox.com

SEE ALSO

Net::LDAP, XML::Parser

COPYRIGHT

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