From: Graham B. <gb...@po...> - 2000-10-03 08:09:28
|
----- Forwarded message from Eric Nichols <eni...@cp...> ----- From: "Eric Nichols" <eni...@cp...> To: "Graham Barr" <gb...@po...> Subject: Re: Catch-22 problem with accessing $entry->{attrs} with perl-ldap-0.16-0.22 Date: Mon, 2 Oct 2000 19:16:09 -0400 X-Mailer: Microsoft Outlook Express 5.50.4133.2400 I'm not sure if this helps but I've used perldap and they have a nice way of accessing the info: $name=$entry->{cn}[0] or @names=$entry->{cn} It's real nice because you can use it in loops etc. hope this helps... ----- Original Message ----- From: "Graham Barr" <gb...@po...> To: <per...@li...> Sent: Friday, September 29, 2000 9:38 AM Subject: Re: Catch-22 problem with accessing $entry->{attrs} with perl-ldap-0.16-0.22 > In the latest release there is an $entry->exists( $attr ) method > > Graham. > > On Fri, Sep 29, 2000 at 07:53:30AM -0400, Eric Boehm wrote: > > I recently upgraded from perl-ldap-0.13 to perl-ldap-0.22 and some code I had > > written broke. > > > > I dropped back to 0.13 and downloaded every version since then. The problem > > starts in perl-ldap-0.16 where attrs is a cache. > > > > I have code that looks like this > > > > $mail_address = ${ $entry->get( $external_addr ) }[0] > > if ( $entry->{attrs}{$external_addr} ); > > > > unless ( $mail_address ) { > > $mail_address = ${ $entry->get( $internal_addr ) }[0] > > if ( $entry->{attrs}{$internal_addr} ); > > } > > > > I did this to avoid error messages about uninitialized values. However, I see > > that in 0.16 the attrs hash doesn't get built until $entry->get is called. > > > > So ... I have a catch-22 -- I can't check to see if an attribute exists > > without getting a possibly non-existent attribute. > > > > Is there a better way to code for this situation? I tried a couple of ways to > > call _build_attrs directly but I couldn't seem to get the syntax right > > ( $entry->_build_attrs and $entry->Net::LDAP::Entry::_build_attrs). > > > > Please cc to my email address as well as the list. I am trying to subscribe to > > the list but I don't know how long it will take. > > > > Thanks in advance, > > -- > > Eric M. Boehm bo...@no... > ----- End forwarded message ----- |