Steve Sanbeg > MediaWiki-EditFramework-0.01 > MediaWiki::EditFramework

Download:
MediaWiki-EditFramework-0.01.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.01   Source   Latest Release: MediaWiki-EditFramework-0.02

NAME ^

MediaWiki::EditFramework - a framework for editing MediaWiki pages.

SYNOPSIS ^

 use MediaWiki::EditFramework;

 my $wiki = MediaWiki::EditFramework->new('example.com', 'wiki');
 my $page = $wiki->get_page('Main_Page');
 my $text = $page->get_text;
 $text =~ s/old thing/new update/g;
 $page->edit($text, 'update page');

DESCRIPTION

This is a higher level framework for editing MediaWiki pages. It depends on another module for lower level API access, and doesn't provide functionality unrelated to editing.

This is the framework that I've been using for the past few years to run an archiving bot. The main features that it has over lower-level frameworks are:

CONSTRUCTOR

new(SITE,PATH)

Create a new instance pointing to the specified SITE and PATH (default w). The underling API object points to http://SITE/PATH/api.php.

METHODS

cookie_jar(FILE)

Passes FILE to LWP::UserAgent's cookie_jar method, to store cookies for a persistent login.

login(USER,PASS)

Log in the specified USER.

get_page(TITLE)

Get the wiki page with the specified TITLE. Returns an instance of MediaWiki::EditFramework::Page, which has methods to get/edit the page text.

create_page(TITLE)

Get the wiki page with the specified TITLE; then croak if it already exists.

write_prefix(PREFIX)

When writing pages, prepend the specified PREFIX to the page title.

This makes it easier to create a test mode for a bot script. By specifying the write prefix in your own user space, the bot will retrieve the normal pages, but the modifications will be written to user space so you can review them without impacting others.

SEE ALSO ^

MediaWiki::API

COPYRIGHT ^

Copyright (C) 2012 by Steve Sanbeg

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.10.1 or, at your option, any later version of Perl 5 you may have available.

syntax highlighting: