On Tue, November 30, 2004 3:05 pm, Vlad Romascanu (QC/EMC) said:
> Passing a referece to a hash of "attribute => values" to Net::LDAP::add
> somewhat as follows:
>
> my %ref = ( "objectclass => [ "top", "etc" ] );
> $ldap->add($dn, "attrs" => \%ref)
>
> ...results in a compilation error:
>
> Not an ARRAY reference at /usr/local/lib/perl5/site_perl/5.8.0/Net/LDAP.pm
> line 439, <INPUT> line 1.
The POD documentation for add states
add ( DN, OPTIONS )
Add a new entry to the directory. DN can be either a
Net::LDAP::Entry object or a string.
attrs => [ ATTR => VALUE, ... ]
VALUE should be a string if only a single value is wanted,
or a reference to an array of strings if multiple values are
wanted.
This argument is not used if DN is a Net::LDAP::Entry object.
control => CONTROL
control => [ CONTROL, ... ]
See "CONTROLS" below
callback => CALLBACK
See "CALLBACKS" below
Example
# $entry is an object of class Net::LDAP::Entry
$mesg = $ldap->add( $entry );
$mesg = $ldap->add( $dn,
attrs => [
name => 'Graham Barr',
attr => 'value1',
attr => 'value2',
multi => [qw(value1 value2)]
]
);
Which I think clearly shows you should pass an array reference.
Graham.