Ruby-net-ldap paged search control

Hi,

Could anyone help me on how to use the ruby-net-ldap paged search
control?
I have read in forums that Net::LDAP library supports paged results
transparently.
My problem is I don’t know how to embed it in my code.

I need to search users from ldap and paginate the results return by the
server.

Here is the sample code.

ldap = Net::LDAP.new( {:host => LDAP_SERVER_IP_ADDRESS,
:port => LDAP_SERVER_PORT } )
#call LDAP authentication
ldap.auth( “#{LDAP_USERNAME}”,"#{LDAP_PWD}" )

user_array = []
user_hash = {}
treebase = “sample treebase”
filter = “myfilter”
attrs = [“sample attributes”]

#bind LDAP authentication
if ldap.bind

ldap.search(:base=>treebase, :filter=>filter,:attributes=>attrs) do
|entry|
#I process the entry here to store in hash
user_hash = {
:name => entry[:cn],
:lastname=>entry[:sn]
}
end
user_array << user_hash
end

return user_array

Please help me on where should do it. Can you please give me code
snippet so that I can embed it in my code.

Many Thanks.