On Fri, Jun 01, 2012 at 11:36:35AM +0200, nguyenkim thuat wrote:
> Yeah, but, how can i do it,
> i think of doing some thing like:
>
> *sub get_file_extensions {
> mw_connect_maybe();
> my $query = {
> action => 'query',
> meta => 'siteinfo',
> siprop => 'fileextensions'
> };
> my $result = $mediawiki->api($query);
>
> ##### how to get the array of file extensions here?
>
>
> }
The same way you parse any other API response? Possibly something like
my @extensions = map $_->{'ext'}, @{$x->{query}{fileextensions}}
will do it.
At worst, use Data::Dumper, print Dumper($result), and look at it to
figure out what type of data structure it is.