From: Jim H. <ha...@us...> - 2002-03-26 16:14:37
|
use " instead of ' filter => "uid=$item" single quotes say to take what is between them literally, doubles say to interpolate values. --Jim Harle On Tue, 26 Mar 2002, Kristina Hildebrand wrote: > Hello, > > I am a fairly new Perl programmer (a few weeks), and am working on > integrating our LDAP directory with another database. I seem to be > having problems with my filter string in one particular instance. I'm > thinking that it has to do with the fact that I'm trying to use a > variable in my filter string. I know that the DBI module has the > ability to bind variables when you execute the SQL statement. Does the > search method of the LDAP module have something similar I can't figure > out? > > Here's the code that seems to be giving me trouble: > my $mesg = $ldap->search(...,filter => 'uid=$item', ...) > die ($mesg->error) if $mesg->code; > > #put the attributes in a hash table > my %user; > my $entry = $mesg->entry; > #the following line is the one giving me trouble, saying I can't execute > the > #attributes method on a null value. I figure this is because it's not > finding any > #entries where uid equals "$item" > foreach my $attr ($entry->attributes){ > $user{$attr} = $entry->get_value($attr); > } > > This code works perfectly when I have "...filter=> 'uid=kdhilde'..." > > Please respond to me directly, as well as the list, because the message > that I sent to per...@ma... to subscribe to > the list bounced back. > > Thank-you very much, > Kristina Hildebrand > > |