On Mon, 9 Aug 2004, Luis Daniel Lucio Quiroz wrote:

And Ramprasad is write, it's a LDAP-Perl scructure. I need to construct this structure on fly when executin a script. So I wish first how to access.

So, lets tell  I want to add another element.

After doing:
my %hash = @{$a};

Did you try a `perldoc Net::LDAP` yet?

  SYNOPSIS
    use Net::LDAP;

    $ldap = Net::LDAP->new( 'ldap.bigfoot.com' ) or die "$@";

    $mesg = $ldap->bind ;    # an anonymous bind

    $mesg = $ldap->search( # perform a search
                           base   => "c=US",
                           filter => "(&(sn=Barr) (o=Texas Instruments))"
                         );

    $mesg->code && die $mesg->error;

    foreach $entry ($mesg->entries) { $entry->dump; }

    $mesg = $ldap->unbind;   # take down session

    $ldap = Net::LDAP->new( 'ldap.umich.edu' );

    # bind to a directory with dn and password
    $mesg = $ldap->bind( 'cn=root, o=University of Michigan, c=us',
                         password => 'secret'
                       );

    $result = $ldap->add( 'cn=Barbara Jensen, o=University of Michigan, c=US',
                          attr => [
                            'cn'   => ['Barbara Jensen', 'Barbs Jensen'],
                            'sn'   => 'Jensen',
                            'mail' => '[EMAIL PROTECTED]',
                            'objectclass' => ['top', 'person',
                                              'organizationalPerson',
                                              'inetOrgPerson' ],
                          ]
                        );

    $result->code && warn "failed to add entry: ", $result->error ;
    $mesg = $ldap->unbind;  # take down session

Can you not add an entry this way?



--
Chris Devers

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to