From: <Bob...@kp...> - 2002-04-03 00:23:35
|
The problem is in the join() -- print join("\n ",$attr, $entry->get_value($attr)),"\n"; You are joining two character strings, "\n" and ",$attr, $entry->get_value($attr)),". Perl is interpolating the values for "$attr" and "$entry" into your strings to get your strange looking output. Restructure the code a trifle: for($i = 0 ; $i < $max ; $i++) { my $entry = $mesg->entry($i); print("/n"); #### start on a new line foreach my $attr ($entry->attributes) { print ("$attr, ", #### print name of attribute $entry->get_value($attr), #### print value of attribute ", \n" ); #### print a comma and skip to next line } } B Bob Goolsby bob...@kp... (925) 926-3406 ----- Forwarded by Bob Goolsby/CA/KAIPERM on 04/02/2002 04:03 PM ----- Graham Barr <gb...@po...> Sent by: per...@li... 04/02/2002 01:28 PM To: LDAP Mailing List <per...@li...> cc: Daniel Cheung <ti...@ho...> Subject: [Fwd] help ----- Forwarded message from Daniel Cheung <ti...@ho...> ----- Date: Tue, 02 Apr 2002 16:11:16 -0500 To: gb...@po... From: "Daniel Cheung" <ti...@ho...> use Net::LDAP; Dear Graham: You did a good job on Perl LDAP. However, when I try to use your following code: $ldap = Net::LDAP->new($host); $mesg = $ldap->search(@search_args); my $max = $mesg->count; for($i = 0 ; $i < $max ; $i++) { my $entry = $mesg->entry($i); foreach my $attr ($entry->attributes) { print join("\n ",$attr, $entry->get_value($attr)),"\n"; } } I got strange output like these: objectClass, Net::LDAP::Entry=HASH(0xcb99c)->get_value('objectClass') rdn, Net::LDAP::Entry=HASH(0xcb99c)->get_value('rdn') cn, Net::LDAP::Entry=HASH(0xcb99c)->get_value('cn') rfc822Mailbox, Net::LDAP::Entry=HASH(0xcb99c)->get_value('rfc822Mailbox') mail, Net::LDAP::Entry=HASH(0xcb99c)->get_value('mail') textEncodedORaddress, Net::LDAP::Entry=HASH(0xcb99c)->get_value('textEncodedORaddress') otherMailbox, Net::LDAP::Entry=HASH(0xcb99c)->get_value('otherMailbox') givenName, Net::LDAP::Entry=HASH(0xcb99c)->get_value('givenName') uid, Net::LDAP::Entry=HASH(0xcb99c)->get_value('uid') MAPI-Recipient, Net::LDAP::Entry=HASH(0xcb99c)->get_value('MAPI-Recipient') sn, Net::LDAP::Entry=HASH(0xcb99c)->get_value('sn') telephoneNumber, Net::LDAP::Entry=HASH(0xcb99c)->get_value('telephoneNumber') co, Net::LDAP::Entry=HASH(0xcb99c)->get_value('co') It seems that the get_value function is not working? Could you please tell me why? Thanks Dan _________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp. ----- End forwarded message ----- |