From 232d3a231d987d47f188118b7aee6fd68bd69c2c Mon Sep 17 00:00:00 2001 From: miker Date: Sun, 19 Feb 2006 01:19:07 +0000 Subject: [PATCH] fixups, and starting a paged interface git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@641 9efc2488-bf62-4759-914b-345cdb29e865 --- src/perlmods/OpenSRF/Application.pm | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/src/perlmods/OpenSRF/Application.pm b/src/perlmods/OpenSRF/Application.pm index 922ed52..738bae7 100644 --- a/src/perlmods/OpenSRF/Application.pm +++ b/src/perlmods/OpenSRF/Application.pm @@ -620,22 +620,32 @@ sub introspect { my $self = shift; my $client = shift; my $method = shift; + my $limit = shift; + my $offset = shift; $method = undef if ($self->api_name =~ /all$/o); + my ($seen,$returned) = (0,0); for my $api_level ( reverse(1 .. $#_METHODS) ) { for my $api_name ( sort keys %{$_METHODS[$api_level]} ) { - if (!$_METHODS[$api_level]{$api_name}{remote}) { - if (defined($method)) { - if ($api_name =~ $method) { - $client->respond( $_METHODS[$api_level]{$api_name} ); + if (!$offset || $offset < $seen) { + if (!$_METHODS[$api_level]{$api_name}{remote}) { + if (defined($method)) { + if ($api_name =~ $method) { + if (!$limit || $returned < $limit) { + $client->respond( $_METHODS[$api_level]{$api_name} ); + $returned++; + } + } + } else { + if (!$limit || $returned < $limit) { + $client->respond( $_METHODS[$api_level]{$api_name} ); + $returned++; + } } - } else { - $log->debug( "Returning definition for method [$api_name]", INTERNAL ); - $client->respond( $_METHODS[$api_level]{$api_name} ); - $log->debug( "responed with definition for method [$api_name]", INTERNAL ); } } + $seen++; } } -- 2.11.0