SEARCH
NEW RPMS
DIRECTORIES
ABOUT
FAQ
VARIOUS
BLOG
DONATE




YUM REPOSITORY

 
 

MAN page from Mandriva 2011 perl-RT-Client-REST-0.410.0-1mdv2011.0.noarch.rpm

RT::Client::REST::SearchResult

Section: User Contributed Perl Documentation (3)
Updated: 2010-07-06
Index 

NAME

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

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 typeof the object you get back when you call method "search()" onRT::Client::REST::Object-derived objects. It makes it easy toiterate over results and find out just how many there are. 

METHODS

count
Returns the number of search results. This number will always be thesame unless you stick your fat dirty fingers into the object and abuseit. This number is not affected by calls to "get_iterator()".
get_iterator
Returns a reference to a subroutine which is used to iterate over theresults.

Evaluating it in scalar context, returns the next objector "undef" if all the results have already been iterated over. Notethat for each object to be instantiated with correct values,retrieve() method is called on the object before returning itto the caller.

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

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

  $iterator = $search->get_iterator;  $first = &$iterator;  $second = &$iterator;  @the_rest = &$iterator;

You can get as many iterators as you want --- they will not step oneach other's toes.

new
You should not have to call it yourself, but just for the sake ofcompleteness, 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,      );    },  );
 

SEE ALSO

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

AUTHOR

Dmitri Tikhonov <dtikhonovAATTyahoo.com>


 

Index

NAME
SYNOPSIS
DESCRIPTION
METHODS
SEE ALSO
AUTHOR

This document was created byman2html,using the manual pages.