From: David R. <d.r...@qu...> - 2001-03-28 23:10:23
|
Hi, I have scoured the archives and while found some interesting posts, nothing that I could get to work for my situation. I am performing a search that will return lots of entries from the directory (about 50,000) and I am getting the error 'Out of memory!' which is not suprising. So, I started writing a search that uses a callback, which will shift the returned entry off the results list, thus (in theory) not running out of memory. Here are the code segments: printf( "Searching...\n" ); $count = 0; $res = $ldap->search( base => $LDAP_BASE, filter => "(objectclass=QUTmailPerson)", attrs => ['uid', 'mailUID', 'QUTmailbox', 'mailboxQuota', 'cn' ], callback => &LDAP_callback() ); sub LDAP_callback { my ( $mesg, $entry ) = @_; printf( "Start Callback\n"); if( ! defined( $mesg ) ) { printf( "MESG Not defined\n" ); if( ! defined( $entry ) ) { printf( "ENT Not defined\n" ); } } else { $mesg->shift_entry(); printf( "Got entry: %d\n", $count++ ); } printf( "End Callback\n"); } This is on the way to building a much larger peice of code, so for now just knowing I got the entries will do. So, this produces the output: Searching... Start Callback MESG Not defined ENT Not defined End Callback Can't use string ("1") as a subroutine ref while "strict refs" in use at /usr/lib/perl-5.005/lib/site_perl/5.005/Net/LDAP/Search.pm line 51. Any idea, help or pointers would be greatly appreciated. Thanks, -- David Richards Project Manager (Messaging) Information Technology Services Queensland University of Technology |