Ramprasad A Padmanabhan
>
> I need to show users from a ldap database. Since there are many (
> thousands ) of users , I want to show them page by page.
> I just installed Data::Page , But there seems to be no direct example on
> how to use it. Can anyone just send me a link to an example.

Hi Ram.

Data::Page isn't as useful as it could be as there are no methods
to modify a Data::Page object. You simply set it up with

  new (<total_data>, <data_per_page>, <page_number>)

and can then drag useful values from it about the current
page. The nicest method is 'splice' which will return the
correct slice of an array for the page. To change pages,
however, you need to create a new object. Take a look below.

HTH,

Rob


  use strict;
  use warnings;

  use Data::Page;

  my @data = 'A' .. 'Z';

  # Go to the third five-element page
  #
  my $data = new Data::Page (scalar @data, 5, 3);
  print map "$_\n", $data->splice([EMAIL PROTECTED]);
  print "--\n";

  # Go to the 'next' (fourth) five-element page
  #
  $data = new Data::Page (scalar @data, 5, $data->next_page);
  print map "$_\n", $data->splice([EMAIL PROTECTED]);
  print "--\n";

  # Go to the last page
  #
  $data = new Data::Page (scalar @data, 5, $data->last_page);
  print map "$_\n", $data->splice([EMAIL PROTECTED]);
  print "--\n";

**OUTPUT

K
L
M
N
O
--
P
Q
R
S
T
--
Z
--





-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to