mr_evans2u has asked for the wisdom of the Perl Monks concerning the following question:
I'm getting this error: Can't use string ("") as a HASH ref while "strict refs" in use at ./functionals.pl line 384.$entry = $AD_conn->search($adld{root}, $adld{scope}, "(&(|(employ +eeID=$UMF))(mail=*))", 0, @attr); if (!$entry) { my $code = $AD_conn->getErrorCode(); if ($code == 0) { print "No Directory records found to process on this run.\n" } else { print "Run terminated on LDAP Error=" . $AD_conn->getErrorStri +ng() . ".\n"; } #$AD_conn->close(); } else { while($entry) { print "employeeID mail: $entry->{mail}[0],\n"; $entry = $AD_conn->nextEntry(); } # End of while loop } my $ID = $entry->{mail}[0]; # Create the new Directory entry # $entry = new Mozilla::LDAP::Entry; $entry->setDN(("cn=$CN,OU=FunctionalContacts,OU=Functional,OU=Exch +ange,OU=Services,") . $adld{root}); $entry->addValue("objectclass", "top"); $entry->addValue("objectclass", "organizationalPerson"); $entry->addValue("objectclass", "person"); $entry->addValue("objectclass", "contact"); $entry->addValue("description", "POC:$ID"); $fa_values{"mailnickname"} = $username; while (($attr,$value) = each %fa_values) { $entry->addValue($attr, $value); } $AD_conn->add($entry); if ($AD_conn->getErrorCode()) { print "FAILED create_record:$entry->{mailNickname}[0] because '" . + $AD_conn->getErrorString() . "'\n\n"; } else { print "Created mailNickname:$entry->{mailNickname}[0]\n"; } }
which is: my $ID = $entry->{mail}[0];
What do I need to do to be able to add the mail address that is being retrieved into the description?
output from print:
employeeID mail: jim.doe@xxxx.com,
employeeID mail: john.smith@xxxx.com,
employeeID mail: mark.jones@xxxx.com,
employeeID mail: mark.jones@xxxx.com,
No Directory records found to process on this run.
employeeID mail: john.doe@xxxx.com,
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Adding attribut to AD
by oeuftete (Monk) on Nov 25, 2008 at 18:35 UTC | |
by mr_evans2u (Novice) on Nov 25, 2008 at 20:18 UTC | |
by mr_evans2u (Novice) on Nov 25, 2008 at 21:04 UTC |