How to merge perl Net::LDAP search objects?

198 views Asked by At

I have a task where I need to compare some employee IDs in a DB with the official source of current employee IDs that lives in an LDAP DB.

So I have a list of 3700 company IDs, which are called uid in the LDAP schema.

I realised that it might not be A Good Thing to just create a huge query like

(|(uid=foo1)(uid2=foo2)....(uid=foo3700))

and submit it. So I came up with the idea of chopping my list into chunks. I did some timing and for chunks of 50 the query ran in 7 minutes, 100 in 4 minutes and 200 in 3.5 minutes.

But now I have several search objects, one per query.

I imagine I can

  1. loop over the chunks and query and process the objects and store the results for reporting later. Or I can

  2. store the search results in some sort of array or hash. Or I can

  3. somehow combine the search results into a big search object.

I kind of like the idea of 3., because it strikes me as the most generic solution, but I have no idea how to do it.

So is 3. a good approach?

If so, how to do it?

Otherwise, what are better approaches to this problem?

0

There are 0 answers