From: Graham B. <gb...@po...> - 2002-01-18 10:58:32
|
On Fri, Jan 18, 2002 at 05:16:28AM +0100, Kjetil Torgrim Homme wrote: > Bob...@kp... writes: > > > The size limit is imposed on the Server side, sigh. > > > > for i ("a" .. "z") { > > > > $filter = "mailhost=ms001" . $i . "dc3.adelphia.net"; > > This filter should be immutable if I read the OP correctly. Something > like > > $filter = "(|(mailhost=ms001a.dc3.adelphia.net)(mail=$i*))"; > > may make more sense. > > It would also be pertinent to specify a smaller set of attributes to > reduce the load on the server and network. You can also use a trivial > callback function to reduce memory requirements on the client. > (Otherwise Perl will need to hold _all_ entries in memory.) > > $count = 0; > > $message = $ldap->search( > base => ("$ouline,$oline"), > scope => 'sub', > filter => ("$filter"), > attrs => [ "objectClass" ], Adding typesonly => 1 will also help reduce network traffic. As you are only looking for the dn there is no need to request the content of the attributes. > callback => sub { $_[0]->pop_entry; ++$count }, That will count 1 too many. When the serch completes the callback is called without a second argument. callback => sub { $_[0]->pop_entry and ++$count }, Graham. > ); > > > (Coded, but not verified.) > > Ditto :-) > > The callback really should handle the case where $_[1] isn't an > Net::LDAP::Entry (e.g. is a reference). > > > Kjetil T. > |