Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

I use Net::Ldap::Entry for generating ldif's which I later feed to the ldap server with ldapadd ( well not the most elegant solution, but I like to check the ldif before executing it on the server)

So for example the code like that works just fine:
sub mkgrp{ my $ldapgrp = Net::LDAP::Entry->new; my $group_dn = 'cn='.$group.',ou=group,'.$topdn; my $description = $descr || $group; $ldapgrp->dn($group_dn); $ldapgrp->add( objectClass => [ qw(sambaGroupMapping posixGroup )], displayName => $group, sambaGroupType => '2', sambaSID => 'S--blablabla-'.${groupSID}, description => $description, gidNumber => $gid, cn => $group, memberUID => [ @memberUID ], ); return $ldapgrp; } my $ldif = Net::LDAP::LDIF->new( "$ldifpath", "w+", onerror => 'warn' + ); $ldifpath = "/tmp/${group}.ldif"; $ldif->write_entry($ldapgrp);

What I can not achieve with this module is to create an ldif with multiple changes to the same DN

For example I see no way to generate such ldif:

print $fh <<"END"; dn: $dn changetype: modify add: mail mail: $maillist - add: mailAlternateAddress mailAlternateAddress: - add: mailMessageStore mailMessageStore: - replace: objectClass objectClass: posixGroup objectClass: qmailGroup objectClass: sambaGroupMapping END
Is there a way to do that with Net::LDAP::Entry or any other module or shell I just give up?

In reply to Net::LDAP::Entry, modify multiple attributes within one DN by noname

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, 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, 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.
  • Log In?

    What's my password?
    Create A New User
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others romping around the Monastery: (4)
    As of 2018-09-20 06:49 GMT
    Find Nodes?
      Voting Booth?
      Eventually, "covfefe" will come to mean:

      Results (173 votes). Check out past polls.

      • (Sep 10, 2018 at 22:53 UTC) Welcome new users!