NAME
MediaWiki::EditFramework::Page - a MediaWiki page object.
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 module represents a MediaWiki page. When instantiated, it gets the page information from the site. The last modified timestamp is stored when the page is retrieved, and passed back via the edit method to allow the server to properly detect edit conflicts.
METHODS
- get_text
-
Get the current page text.
- edit(TEXT,SUMMARY)
-
Replace the text of the page with the specified TEXT. Using the specified SUMMARY as the edit summary to describe the edit.
The original timestamp will be passed back; if the page was editing between when it was retrieved and when edit is called, and the server cannot automatically merge our edit, then the edit will be rejected in order to prevent clobbering the other edit.
If the MediaWiki::EditFramework object has an edit_prefix in effect, that will be prepended to the page name. This allow redirecting the output from an edit into user space, to facilitate testing bot code.
- exists
-
Returns true if the underlying page existed on the server when the page was rretrieved, false if it is a new page.
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.