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; }

In reply to Net::LDAP::Entry->update hangs by selena

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.