.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Net::LDAP::DSML 3pm" .TH Net::LDAP::DSML 3pm "2021-01-03" "perl v5.32.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Net::LDAP::DSML \-\- A DSML Writer for Net::LDAP .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& For a directory entry; \& \& 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(); \& \& \& # \& # For file i/o \& # \& my $file = "testdsml.xml"; \& \& my $io = IO::File\->new($file,"w") \& or die ("failed to open $file as filehandle.$!\en"); \& \& my $dsml = Net::LDAP::DSML\->new(output => $io, pretty_print => 1 ) \& or die ("DSML object creation problem using an output file.\en"); \& # OR \& # \& # For file i/o \& # \& \& open (IO,">$file") or die("failed to open $file.$!"); \& \& my $dsml = Net::LDAP::DSML\->new(output => *IO, pretty_print => 1) \& or die ("DSML object creation problem using an output file.\en"); \& \& # OR \& # \& # For array usage. \& # Pass a reference to an array. \& # \& \& my @data = (); \& $dsml = Net::LDAP::DSML\->new(output => \e@data, pretty_print => 1) \& or die ("DSML object creation problem using an output array.\en"); \& \& \& my $mesg = $ldap\->search( \& base => \*(Aqo=airius.com\*(Aq, \& scope => \*(Aqsub\*(Aq, \& filter => \*(Aqou=accounting\*(Aq, \& callback => sub { \& my ($mesg,$entry) =@_; \& $dsml\->write_entry($entry) \& if (ref $entry eq \*(AqNet::LDAP::Entry\*(Aq); \& } \& ); \& \& die ("search failed with ",$mesg\->code(),"\en") if $mesg\->code(); \& \& For directory schema; \& \& A file or array can be used for output, in the following example \& only an array will be used. \& \& my $schema = $ldap\->schema(); \& my @data = (); \& my $dsml = Net::LDAP::DSML\->new(output => \e@data, pretty_print => 1 ) \& or die ("DSML object creation problem using an output array.\en"); \& \& $dsml\->write_schema($schema); \& \& print "Finished printing DSML\en"; .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" Directory Service Markup Language (\s-1DSML\s0) is the \s-1XML\s0 standard for representing directory service information in \s-1XML.\s0 .PP At the moment this module only writes \s-1DSML\s0 entry and schema entities. Reading \s-1DSML\s0 entities is a future project. .PP Eventually this module will be a full level 2 consumer and producer enabling you to give you full \s-1DSML\s0 conformance. Currently this module has the ability to be a level 2 producer. The user must understand the his/her directory server will determine the consumer and producer level they can achieve. .PP To determine conformance, it is useful to divide \s-1DSML\s0 documents into four types: .PP .Vb 6 \& 1.Documents containing no directory schema nor any references to \& an external schema. \& 2.Documents containing no directory schema but containing at \& least one reference to an external schema. \& 3.Documents containing only a directory schema. \& 4.Documents containing both a directory schema and entries. .Ve .PP A producer of \s-1DSML\s0 must be able to produce documents of type 1. A producer of \s-1DSML\s0 may, in addition, be able to produce documents of types 2 through 4. .PP A producer that can produce documents of type 1 is said to be a level 1 producer. A producer than can produce documents of all four types is said to be a level 2 producer. .SH "CALLBACKS" .IX Header "CALLBACKS" 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 \s-1DSML\s0 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. .SH "CONSTRUCTOR" .IX Header "CONSTRUCTOR" .IP "new ()" 4 .IX Item "new ()" Creates a new Net::LDAP::DSML object. There are 2 options to this method. .Sp \&\f(CW\*(C`output\*(C'\fR is a reference to either a file handle that has already been opened or to an array. .Sp \&\f(CW\*(C`pretty_print\*(C'\fR is an option to print a new line at the end of each element sequence. It makes the reading of the \s-1XML\s0 output easier for a human. .Sp \&\fBExample\fR .Sp .Vb 2 \& my $dsml = Net::LDAP::DSML\->new(); \& Prints xml data to standard out. \& \& my $dsml = Net::LDAP::DSML\->new(output => \e@array); \& my $dsml = Net::LDAP::DSML\->new(output => *FILE); \& Prints xml data to a file or array. \& \& my $dsml = Net::LDAP::DSML\->new(output => \e@array, pretty_print => 1); \& my $dsml = Net::LDAP::DSML\->new(output => *FILE, pretty_print => 1); \& Prints xml data to a file or array in pretty print style. .Ve .SH "METHODS" .IX Header "METHODS" .IP "start_dsml ()" 4 .IX Item "start_dsml ()" Start a \s-1DSML\s0 file. .IP "end_dsml ()" 4 .IX Item "end_dsml ()" End a \s-1DSML\s0 file. .IP "write_entry ( \s-1ENTRY\s0 )" 4 .IX Item "write_entry ( ENTRY )" Entry is a Net::LDAP::Entry object. The write method will parse the \s-1LDAP\s0 data in the Entry object and put it into \s-1DSML XML\s0 format. .Sp \&\fBExample\fR .Sp .Vb 2 \& my $entry = $mesg\->entry(); \& $dsml\->write_entry($entry); .Ve .IP "write_schema ( \s-1SCHEMA\s0 )" 4 .IX Item "write_schema ( SCHEMA )" Schema is a Net::LDAP::Schema object. The write_schema method will parse the \s-1LDAP\s0 data in the Schema object and put it into \s-1DSML XML\s0 format. .Sp \&\fBExample\fR .Sp .Vb 2 \& my $schema = $ldap\->schema(); \& $dsml\->write_schema($schema); .Ve .SH "AUTHOR" .IX Header "AUTHOR" Graham Barr gbarr@pobox.com .SH "SEE ALSO" .IX Header "SEE ALSO" Net::LDAP, XML::SAX::Base .SH "COPYRIGHT" .IX Header "COPYRIGHT" Copyright (c) 2002\-2006 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.