User:AnomieBOT/source/AnomieBOT/API/Iterator.pm/doc

NAME
AnomieBOT::API::Iterator - AnomieBOT API iterator class

SYNOPSIS
use AnomieBOT::API; my $api = AnomieBOT::API->new('/path/to/config_file', 1); $api->login; my $iter = $api->iterator(list=>'allpages', apnamespace=>0, aplimit=>10); while(my $res = $iter->next){ # Do stuff }

DESCRIPTION
is a class implementing various functions needed by a MediaWiki bot. This class represents an iterator over a result set.

METHODS

 * $iter->cur
 * This returns the current result page, or undef if there is no current result.
 * Note that no API query is done on creation, and thus no result object is current.  must be called at least once before this function is useful.


 * $iter->next
 * This moves the pointer to the next result and returns it, performing API queries as necessary.
 * The return object is normally a hashref representing one page object, with an additional property  set to a true value. If   is false, the returned hashref is instead the error object as returned by  . Calling   again after an error will retry the API query, which may or may not succeed.
 * When no more results are available, undef is returned.

COPYRIGHT
Copyright 2008–2013 Anomie

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