
metazone
New User
Dec 3, 2008, 1:29 PM
Post #1 of 4
(1512 views)
|
|
Can't locate XML/SAX/Writer.pm
|
Can't Post
|
|
Trying to get simple perl script working w/ Net::LDAP::LDIF and use Net::LDAP::DSML. I want to read from an LDIF and convert to XML (DSML). Using ActiveState Perl on Windows Server 2003 SP2. Simple read from LDIF works ok; w/ DSML, I get the following: "Can't locate XML/SAX/Writer.pm in @INC (@INC contains: C:/Perl/site/lib C:/Perl/lib .) at C:/Perl/site/lib/Net/LDAP/DSML.pm line 36, <DATA> line 409." In installed Net::LDAP from http://ldap.perl.org and then installed SAX Parser from http://search.cpan.org/~khampton/XML-SAX-Base-1.02/. I attached a screen shot of my perl/site/lib folder. The code is as follows: use Net::LDAP::LDIF; use Net::LDAP; use Net::LDAP::DSML; use IO::File; use XML::SAX::Base; $fileNameDsml = "bootDsml.xml"; $ioDsml = IO::File->new($fileNameDsml,"w") or die ("failed to open $fileNameDsml as filehandle.$!\n"); $dsml = Net::LDAP::DSML->new(output => $ioDsml, pretty_print => 1 ) or die ("DSML object creation problem using an output file.\n"); $fileNameLdif = "boot.ldif"; $ldif = Net::LDAP::LDIF->new( "boot.ldif", "r", onerror => 'undef' ); while( not $ldif->eof ( ) ) { $entry = $ldif->read_entry ( ); if ( $ldif->error ( ) ) { print "Error msg: ", $ldif->error ( ), "n"; print "Error lines:n", $ldif->error_lines ( ), "n"; } else { $dsml->write_entry($entry); } } $ldif->done ( ); I must be missing something really basic ... Thanks, Bill
(This post was edited by metazone on Dec 3, 2008, 1:32 PM)
|