User:AnomieBOT/source/AnomieBOT/API/Iterator.pm: Difference between revisions

Content deleted Content added
AnomieBOT (talk | contribs)
Updating published sources: General: * BREAKING CHANGE: Adjust whine to take keyed parameters for all the optional junk. * Add the ability for whine to take all the edittoken options, plus "NoSmallPrint" and "NoSig". * Add a "query iterator" to the A
 
AnomieBOT (talk | contribs)
Updating published sources: General: * D'oh, of course the node set can be empty in the iterator. * Minor doc fixes. WikiProjectTagger: * Completed.
Line 45:
 
shift @{$self->{'res'}};
unlesswhile(!@{$self->{'res'}}){
return undef unless exists($self->{'query'});
 
Line 76:
code => 'wtferror',
error => 'The result node list is not an array or hash reference. WTF?',
};
}
if(@$ret < 1){
return {
_ok_ => 0,
code => 'wtferror',
error => 'The result node list is empty. WTF?',
};
}
Line 152 ⟶ 145:
The return object is normally a hashref representing one page object, with an
additional property C<_ok_> set to a true value. If C<_ok_> is false, the
returned hashref is instead the error object as returned by C<< $api->query() >>.
Calling $iter->next again after an error will retry the API query, which may or
may not succeed.