selena has asked for the wisdom of the Perl Monks concerning the following question:
Anyone had this problem? I am importing text from a file, using uuidgen to create a new uuid - but when I try to do the $entry->update, the script hangs.
I tried debug=>'4' on the ldap server connection and saw some weirdness - not all the text from my entry data was showing up in the output. So I tried to add an entry with just 'objectClass' => 'top'.. and that worked! However, as soon as I try to add even 'cn', the whole thing hangs again. Printing out the entry in LDIF format using Net::LDAP::LDIF yields a working entry that can be added to the ldap server. Also, I'm able to successfully modify or add attributes to existing entries on the server. Here's a stripped down version of the script that hangs.
The input file looks like:
FowlerActivity,Fowler Activity Directors,{MD5}laksdfjjkdkd==
Script is:
use Carp; use Net::LDAP; use Net::LDAP::Entry; my $server = "ldap"; my $searchstring = "objectClass=*"; my $ldap = Net::LDAP->new($server, debug =>4); my $mesg = $ldap->bind( 'cn=admin,dc=ldap', password => 'secret'); $mesg->is_error && warn $mesg->error, "\n"; my $filename = shift; open (FILE, "$filename") || croak "can't open file $filename: $?"; my %misc = (); while (<FILE>) { chomp; my @items = split(','); my $uuid = `/usr/bin/uuidgen`; chomp $uuid; $misc{$uuid} = \@items; } foreach my $u (keys %misc) { my $fullname = $misc{$u}->[1]; my ($firstname, $lastname) = split(' ', $fullname, 2); chomp $lastname; my $dn = "cn=" . $u . ",ou=Misc,dc=ldap"; $entry = new Net::LDAP::Entry->new; $entry->dn($dn); $entry->add( 'objectClass' => "person", 'cn' => $u, 'sn' => $lastname, ); my $result = $entry->update($ldap); $result->code && warn "couldn't add $dn: ", $result->error; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Net::LDAP::Entry->update hangs
by mikfire (Deacon) on Mar 02, 2004 at 19:41 UTC | |
by selena (Acolyte) on Mar 02, 2004 at 21:05 UTC |