From: Graham B. <gb...@po...> - 2000-08-08 13:13:39
|
On Tue, Aug 08, 2000 at 02:32:24PM +0200, Karl-Heinz Rastofer wrote: > I just installed the new version. > > $entry->get(attribute) now gives back a reference to an array and no more the > value. > $entry->dn gives back the dn . > > (AIX 4.3 / Perl 5.00503) > > Has there changed something ? Yes, I was waiting for someone to report that, and I am surprised it took so long. The RELEASE_NOTES do state * Net::LDAP::Entry->get now always returns a scalar result as documented. The fact is ->get was never documented to return list, only a reference to a list. In 0.20 you can now ask for all options to an attribute so $entry->get('cn', alloptions => 1); will return a hash reference which may look like { 'en' => "value for cn;en", 'fr' => "value for cn;fr" }; It was in adding this I noticed the list return for get. The problem with the list return is that if an attribute exists, but is empty you cannot tell because you get the empty list, just like you do if the attribute does not exist. However I can see how people might like the list return so for single valued entries you get my $cn = $entry->get('cn'); as opposed to my $cn = $entry->get('cn')->[0]; I am open to suggestions. The only thing I can think of is to revert to what was there, allow the hash return in a list context too and add and exists method to check if an attribute exists. Comments. Graham. |