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
RT::Client::REST::SearchResult(3) User Contributed Perl Documentation RT::Client::REST::SearchResult(3)

RT::Client::REST::SearchResult - search results object.

version 0.60

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

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

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.

count
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()".
get_iterator
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, retrieve() 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 retrieve() 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.

new
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, that's a closure.
      RT::Client::REST::Ticket->new(
        id => shift,
        rt => $rt,
      );
    },
  );
    

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

Dmitri Tikhonov

This software is copyright (c) 2020, 2018 by Dmitri Tikhonov.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

2022-04-07 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

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