#! /usr/bin/perl -w

use strict;
use WWW::Mechanize;
my $mech = WWW::Mechanize->new(agent=>'bug test');

my $url = 'http://en.wikipedia.org/w/index.php?title=Special:Export';

sub export( $;$ ) {
    my $url = shift;
    my $pagelist = shift;

    my %fields = (templates=>1, curonly=>1, pages=>$pagelist);

    $mech->get($url);
    $mech->submit_form(with_fields=> \%fields);

    if ($mech->content() =~ /^<mediawiki /) {
	print $mech->content();
    } else {
	warn "Bogus content";
    }
}

export ($url, 'Main_Page');
