Content deleted Content added
Updating published sources: AnomieBOT::API::Iterator * Apparently "no nodes" is valid when using a generator. |
Updating published sources: General: * Remove pointless copyright notices with dates I never remember to update. * Add LICENSE.txt file instead. |
||
(7 intermediate revisions by the same user not shown) | |||
Line 1:
{{ombox|text=See [[/doc]] for formatted documentation}}
<
package AnomieBOT::API::Iterator;
Line 61:
}
my
delete $res{'normalized'};
delete $res{'redirects'};
delete $res{'interwiki'};
my @res=values %res;
if(@res > 1){
return {
_ok_ => 0,
code => 'notiterable',
error => 'The result set contained too many nodes under the query node: '.join(', ', keys %
};
} elsif(@res > 0){
Line 136 ⟶ 140:
Note that no API query is done on creation, and thus no result object is
current. C<< $iter->next >> must be called at least once before this function is
useful.
Line 146 ⟶ 150:
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 C<< $iter->next >> again after an error will
retry the API query, which may or may not succeed. When no more results are available, undef is returned.
=back
=cut
</syntaxhighlight>
|