From: Mark W. <mew...@un...> - 2000-09-07 21:44:06
|
Actually I just reread your code. the problem is that in .20, get always returns back an array context. you need to do print " $attr : ",@$entr->get($attr),"\n"; Mark On Thu, 7 Sep 2000, Mark Weixel wrote: > Greetings, > > I installed perl-ldap .20 today in order to experiment with > Net::LDAP::Control::Sort (turns out my server doesn't support > sorting...) Unfortunately, after doing this, the sample code that I had > copied from the Examples page stopped dereferencing the information in > the individual entry references. > > I'm doing this under Win32, using ActiveState Perl build 617. > ActivePerl's PPM only has perl-ldap .15, so I downloaded the > distribution at SourceForge and installed by hand using NMake. > > As a result, the following: > > use strict; > use Net::LDAP; > use vars qw($ldap $mesg $entry); > > > > $ldap = Net::LDAP->new('ucis-nt.ucis.pitt.edu:389') or die "$@"; > > $ldap->bind ; # an anonymous bind > > $mesg = $ldap->search ( # perform a search > base => "c=US", > scope => 'sub', > filter => "(|(objectClass=organizationalPerson))" > ); > > $mesg->code && die $mesg->error; > #print $mesg->control; > #my @entries = $mesg->entries; > > > #------------ > # > # handle each of the results independently > # ... i.e. using the walk through method > # > my @entries = $mesg->entries; > > my $entr ; > foreach $entr ( @entries ) > { > print "DN: ",$entr->dn,"\n"; > #my @attrs = sort $entr->attributes; > > my $attr; > foreach $attr ( sort $entr->attributes ){ > #skip binary we can't handle > next if ( $attr =~ /;binary$/ ); > } > > #print "@attrs\n"; > print "#-------------------------------\n"; > } > > # > # end of walk through method > #------------ > > Results in: > > DN: cn=dmjst17,cn=Recipients,ou=UCIS,o=University of Pittsburgh > MAPI-Recipient : ARRAY(0x1f0cfe4) > cn : ARRAY(0x1f0cd98) > distinguishedName : ARRAY(0x1f0cde0) > givenName : ARRAY(0x1f0cf48) > mail : ARRAY(0x1f0ce70) > objectClass : ARRAY(0x1f0e8d4) > otherMailbox : ARRAY(0x1f0cf00) > rdn : ARRAY(0x1f0cd38) > rfc822Mailbox : ARRAY(0x1f0ce28) > sn : ARRAY(0x1f0d02c) > textEncodedORaddress : ARRAY(0x1f0ceb8) > uid : ARRAY(0x1f0cf9c) > > Is this most likely an ActivePerl problem? Is it a perl-ldap problem? > > Insight would be greatly appreciated. > > --Mark > ----- > Mark J. Weixel > Information Technology Projects Manager > University Center for International Studies > University of Pittsburgh > Pittsburgh, PA 15260 USA > we...@pi... > > |