From: Graham B. <gb...@po...> - 2002-10-09 16:36:11
|
On Wed, Oct 09, 2002 at 06:34:57PM +0200, Carlos Fuentes Bermejo wrote: > > > > Here is a short script that reads a DSML file and reproduces it > > on the output by going via Net::LDAP::DSML > > > > my $writer = Net::LDAP::DSML->new; > > $writer->start_dsml; > > my $sax = Net::LDAP::DSML->new( > > entry => sub { $writer->write_entry($_[0]) }, > > schema => sub { $writer->write_schema($_[0]) }, > > ); > > my $rdr = XML::SAX::Expat->new(Handler => $sax); > > $rdr->parse_file(\*STDIN); > > > > $writer->end_dsml; > > > > Graham. > > > > I have just tested it, and it writes the results in DSML to standard > output. What I meant by "import DSML" was to be able to read a file in > DSML and import the data into the LDAP server (much as ldapadd does > using ldif). I do not know if I did not explain myself well or I was > not able to get your point in the example. The two anon-sub above are what handle the incoming objects. If you read it you will see that it is the entry => sub { ... } which is telling the $writer object to write the entry. So just replace that sub with one which adds the entry to you server. Graham. |