NAME
MediaWiki::DumpFile::Pages - Process an XML dump file of pages from a MediaWiki instance
SYNOPSIS
use MediaWiki::DumpFile::Pages;
$pages = MediaWiki::DumpFile::Pages->new($file);
$pages = MediaWiki::DumpFile::Pages->new(\*FH);
while(defined($page = $pages->next) {
print 'Title: ', $page->title, "\n";
print 'Text: ', $page->revision->text, "\n";
}
METHODS
new
This is the constructor for this package. It is called with a single parameter: the location of a MediaWiki pages dump file or a reference to an already open file handle.
next
Returns an instance of MediaWiki::DumpFile::Pages::Page or undef if there is no more pages available.
MediaWiki::DumpFile::Pages::Page
This object represents a distinct Mediawiki page and is used to access the page data and metadata. The following methods are available:
- title
-
Returns a string of the page title
- id
-
Returns a numerical page identification
- revision
-
In scalar context returns the most recent revision data for this page; in array context returns a list of all revisions made available for the page in the same order as the dump file. All returned data is an instance of MediaWiki::DumpFile::Pages::Revision
MediaWiki::DumpFile::Pages::Page::Revision
This object represents a distinct revision of a page from the Mediawiki dump file. The standard dump files contain only the most specific revision of each page and the comprehensive dump files contain all revisions for each page. The following methods are available:
- text
-
Returns the page text for this specific revision of the page.
- id
-
Returns the numerical revision id for this specific revision - this is independent of the page id.
- timestamp
-
Returns a string value representing the time the revision was created. The string is in the format of "2008-07-09T18:41:10Z".
- comment
-
Returns the comment made about the revision when it was created.