1RT::Client::REST::SearcUhsReersuClotn(t3r)ibuted Perl DoRcTu:m:eCnltiaetnito:n:REST::SearchResult(3)
2
3
4

NAME

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

VERSION

9       version 0.56
10

SYNOPSIS

12         my $iterator = $search->get_iterator;
13         my $count = $iterator->count;
14
15         while (defined(my $obj = &$iterator)) {
16           # do something with the $obj
17         }
18

DESCRIPTION

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

METHODS

26       count
27           Returns the number of search results.  This number will always be
28           the same unless you stick your fat dirty fingers into the object
29           and abuse it.  This number is not affected by calls to
30           "get_iterator()".
31
32       get_iterator
33           Returns a reference to a subroutine which is used to iterate over
34           the results.
35
36           Evaluating it in scalar context, returns the next object or "undef"
37           if all the results have already been iterated over.  Note that for
38           each object to be instantiated with correct values, retrieve()
39           method is called on the object before returning it to the caller.
40
41           Evaluating the subroutine reference in list context returns a list
42           of all results fully instantiated.  WARNING: this may be expensive,
43           as each object is issued retrieve() method.  Subsequent calls to
44           the iterator result in empty list.
45
46           You may safely mix calling the iterator in scalar and list context.
47           For example:
48
49             $iterator = $search->get_iterator;
50
51             $first = &$iterator;
52             $second = &$iterator;
53             @the_rest = &$iterator;
54
55           You can get as many iterators as you want -- they will not step on
56           each other's toes.
57
58       new You should not have to call it yourself, but just for the sake of
59           completeness, here are the arguments:
60
61             my $search = RT::Client::REST::SearchResult->new(
62               ids => [1 .. 10],
63               object => sub {       # Yup, that's a closure.
64                 RT::Client::REST::Ticket->new(
65                   id => shift,
66                   rt => $rt,
67                 );
68               },
69             );
70

SEE ALSO

72       RT::Client::REST::Object, RT::Client::REST.
73

AUTHORS

75       ·   Abhijit Menon-Sen <ams@wiw.org>
76
77       ·   Dmitri Tikhonov <dtikhonov@yahoo.com>
78
79       ·   Damien "dams" Krotkine <dams@cpan.org>
80
81       ·   Dean Hamstead <dean@bytefoundry.com.au>
82
83       ·   Miquel Ruiz <mruiz@cpan.org>
84
85       ·   JLMARTIN
86
87       ·   SRVSH
88
90       This software is copyright (c) 2018 by Dmitri Tikhonov.
91
92       This is free software; you can redistribute it and/or modify it under
93       the same terms as the Perl 5 programming language system itself.
94
95
96
97perl v5.28.1                      2018-12-24 RT::Client::REST::SearchResult(3)
Impressum