Skip Menu |

This queue is for tickets about the MediaWiki-API CPAN distribution.

Report information
The Basics
Id: 42362
Status: resolved
Priority: 0/
Queue: MediaWiki-API

People
Owner: Nobody in particular
Requestors: dan.bolser [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: List all pages seem broken
Date: Tue, 13 Jan 2009 11:47:01 +0000
To: bug-MediaWiki-API [...] rt.cpan.org
From: Dan Bolser <dan.bolser [...] gmail.com>
Sorry I can't provide more details, but the following script (on my system) fails to produce any results: #!/usr/bin/perl -w use strict; use MediaWiki::API; my $mw = MediaWiki::API->new(); $mw->{config}->{on_error} = \&on_error; sub on_error { print "Error code: " . $mw->{error}->{code} . "\n"; print $mw->{error}->{details}. "\n"; die; } $mw->{config}->{api_url} = 'http://en.wikipedia.org/w/api.php'; my $articles = $mw->list( { action => 'query', list => ' allpages', } ); print $articles, "\n"; I just get '0' ! Using latest CPAN version of MediaWiki::API (MediaWiki-API-0.23). Other queries seem to work fine.
On Tue Jan 13 06:48:19 2009, dan.bolser wrote: Show quoted text
> my $articles = > $mw->list( { action => 'query', > list => ' allpages', > } );
you have a space before "allpages". works without this. Note that to list all the pages could take a zillion years to complete. Better to use with a hook, and process gradually, or you will probably run out of memory! :)
One thing, it should return an arrayref and instead it returns a blank array in this case (not by reference). this will be fixed. The API does return a "warning" which isn't currently handled by the perl list wrapper, but you can always call directly via the "api" call if some behaviour seems strange. So if you get a problem with ->list try ->api instead and see the hashref that gets returned. Cheers
Subject: Re: [rt.cpan.org #42362] List all pages seem broken
Date: Tue, 13 Jan 2009 23:05:46 +0100
To: bug-MediaWiki-API [...] rt.cpan.org
From: Dan Bolser <dan.bolser [...] gmail.com>
2009/1/13 Jools Smyth via RT <bug-MediaWiki-API@rt.cpan.org>: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=42362 > > > On Tue Jan 13 06:48:19 2009, dan.bolser wrote: >
>> my $articles = >> $mw->list( { action => 'query', >> list => ' allpages', >> } );
> > you have a space before "allpages". works without this. Note that to
D'oh! Show quoted text
> list all the pages could take a zillion years to complete. Better to use > with a hook, and process gradually, or you will probably run out of > memory! :)
Will do. Thanks for the cool code, and thanks for taking the time to reply to these bugs.
Show quoted text
> Thanks for the cool code, and thanks for taking the time to reply to > these bugs.
you are welcome. Thanks for using MediaWiki::API and giving feedback.