GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  RT::CLIENT::REST::SEARCHRESULT (3)

.ds Aq ’

NAME

RT::Client::REST::SearchResult -- Search results representation.

CONTENTS

SYNOPSIS



  my $iterator = $search->get_iterator;
  my $count = $iterator->count;

  while (defined(my $obj = &$iterator)) {
    # do something with the $obj
  }



DESCRIPTION

This class is a representation of a search result. This is the type of the object you get back when you call method search() on RT::Client::REST::Object-derived objects. It makes it easy to iterate over results and find out just how many there are.

METHODS

<B>countB> Returns the number of search results. This number will always be the same unless you stick your fat dirty fingers into the object and abuse it. This number is not affected by calls to get_iterator().
<B>get_iteratorB> Returns a reference to a subroutine which is used to iterate over the results.

Evaluating it in scalar context, returns the next object or undef if all the results have already been iterated over. Note that for each object to be instantiated with correct values, <B>B>retrieve()<B>B> method is called on the object before returning it to the caller.

Evaluating the subroutine reference in list context returns a list of all results fully instantiated. WARNING: this may be expensive, as each object is issued <B>B>retrieve()<B>B> method. Subsequent calls to the iterator result in empty list.

You may safely mix calling the iterator in scalar and list context. For example:



  $iterator = $search->get_iterator;

  $first = &$iterator;
  $second = &$iterator;
  @the_rest = &$iterator;



You can get as many iterators as you want — they will not step on each other’s toes.

<B>newB> You should not have to call it yourself, but just for the sake of completeness, here are the arguments:



  my $search = RT::Client::REST::SearchResult->new(
    ids => [1 .. 10],
    object => sub {       # Yup, thats a closure.
      RT::Client::REST::Ticket->new(
        id => shift,
        rt => $rt,
      );
    },
  );



SEE ALSO

RT::Client::REST::Object, RT::Client::REST.

AUTHOR

Dmitri Tikhonov <dtikhonov@yahoo.com>
Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 RT::CLIENT::REST::SEARCHRESULT (3) 2015-11-27

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.