Happy, I return with more good news. I have been able to send all search results to a file. However, I wish to iteratively search on PERSON values, writing the result to FILE, as well as the print OUT statements, to build an LDIF. This is not happening. Instead, the print OUT statements are clobbering FILE, overwriting the search results. Here's the code, thanks.
while (<PERSON>){ chomp; $dn = $ldap->search( #return only the employeeID DN base => "$BASEDN", filter => "(&(objectClass=user)(employeeID=$_))", scope => "sub", attrs => ['1.1'] ); my $result = Net::LDAP::LDIF->new( "buildAD.ldif", "a", wrap=>40 ); while( my $entry = $dn->pop_entry() ) { $result->write_entry($entry); } print OUT "changetype: modify"; print OUT "replace: manager"; print OUT "manager: dn","\n"; } $dn = $ldap->unbind; #session ends
In reply to Re^4: Perl Builds an LDIF
by rfransix
in thread Perl Builds an LDIF
by rfransix
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |