Am Tue, 1 Oct 2013 11:38:47 -0700 schrieb Paul Fontenot <ssdv6...@gmail.com>:
> I am just beginning my foray into Perl with LDAP and I'm not getting > what I expected to get from the LDAP server. If I use ldapsearch like > this: > > ldapsearch -h ldap.example.com -p 389 -x -b "c=us" > > Then I recieve what I expect - everything below the basedn, however > when I attempt the same thing ( I *think* I've written this > correctly) in Perl I get the following error: > > "received LDAP error: No such object at ldap_crl.pl line 16, <DATA> > line 749." > > Any direction would be greatly appreciated. > > #!/usr/bin/perl > # > use Net::LDAP; > > my $lsvr = 'ldap.example.com'; > my $ldap = Net::LDAP->new($lsvr) > or die "error connecting to $lsvr: $@"; > > $ldap->bind; # Bind anonymously, that is, no login and pass > > my $results = $ldap->search ( # Perform a > search for 'nvp' > filter => "(&(c=US))" > ); > > if($results->code) { > die "received LDAP error: @{[$results->error]}"; > } > > foreach my $entry ($results->all_entries) { > $entry->dump; > } > > $ldap->unbind; # Unbind and close connection perldoc Net::LDAP::Examples -Dieter -- Dieter Klünter | Systemberatung http://dkluenter.de GPG Key ID:DA147B05 53°37'09,95"N 10°08'02,42"E