Hello list

I am writing a CGI to manage a bunch of user accounts on a directory server. To modify an entry I simply did:

$msg = $e->update($ldap) ;

Unfortunately, I didn't issue a changetype() before, so it didn't what I expected (modify instead of add). So I wrote:

  $e->changetype('modify') ;
  $msg = $e->update($ldap) ;

which produces the following error:

Can't call method "inner" on unblessed reference at /usr/local/share/perl/5.8.0/Net/LDAP/Message line 26, <DATA> line 417.

I am using Debian testing, perl 5.8.0, Net::LDAP::Message version 1.07, Net::LDAP::Entry version 0.20

Could it be a bug or am I doing something wrong?

BTW, to get the desired behaviour I added this q&d patch to my script, but I don't like it as a permanent solution...

    # The followingo code raises an error: bug in Net::LDAP::Message?
    # $e->changetype('modify') ;
    # $msg = $e->update($ldap) ;

    # This is a temporary patch, until we know if there is something
    # wrong on that module, or if we are doing wrong somewhere
    {
      my %changes ;
      foreach my $attr ($e->attributes( nooptions => 1 )) {
        my @values = $e->get_value($attr) ;
        $changes{$attr} = @values == 1? $values[0]: [EMAIL PROTECTED] ;
      }
      $msg = $ldap->modify($e,replace => \%changes) ;
    }

thanks for help
--M

--
Marco Marongiu                            Email: [EMAIL PROTECTED]
System Administrator                      Phone: +39 070 460 1684
Tiscali S.p.A.



Reply via email to