The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Mediawiki::Blame - see who is responsible for each line of page content

VERSION

This document describes Mediawiki::Blame version 0.0.3

SYNOPSIS

    use Mediawiki::Blame qw();
    my $mb = Mediawiki::Blame->new(
        export => 'http://example.org/wiki/Special:Export',
        page   => 'User:The Demolished Man',
    );
    $mb->fetch(
        before => 'now',
    );
    my @revisions = $mb->revisions;
    my @blame = $mb->blame;

DESCRIPTION

In Mediawiki, it is really easy to see who was responsible for a certain edit. But what if you want to know who is responsible for a piece of content? That would require you to go through all revisions manually.

This module does the work for you by using a dump of the revision history and shows for each line of a Mediawiki page source who edited it last.

INTERFACE

new

Takes a hash with the keys export and page.

The value to export is a URL to the export page of the Mediawiki installation you want to query. Typical examples are http://example.org/wiki/Special:Export or http://example.org/w/index.php?title=Special:Export.

The value to page is the name of the page you want to examine.

Returns a Mediawiki::Blame object.

fetch

Fetches some revisions from the Mediawiki, looking backward or forward from some point in time.

Takes a hash with the keys either before or after, and optionally limit.

The values to before or after are ISO 8601 timestamps as used in Mediawiki, for instance 2007-07-23T21:43:56Z. Times are in the UTC timezone. You can also pass the string value now to the key before, then the current date and time is used.

The value to limit is a natural number greater or equal to 2, and specifies how many revisions are fetched for examination. Smaller numbers mean faster download and analysis, but less useful results. There is a server-side hard limitation of 100.

Returns an array of two elements. At index 0 is a number indicating how many revisions have been fetched. At index 1 is a number indicating how many revisions from the fetching are duplicates, that is were already existing in the internal store.

You cannot know that the revisions are without gaps if you are not careful how you "fetch". Gaps in the revision history ruin the analysis and blame the wrong contributor.

ua_timeout

Takes a natural number, indicating the amount of seconds fetching revisions can take before the program gives up. Default is 30.

revisions

Returns an array of revisions, sorted oldest first.

blame

Takes optionally a single element hash with the key revision.

The value to revision is a Mediawiki revision id.

If no revision is specified, the youngest/most recent is assumed.

Returns an array of blame lines.

EXPORTS

Nothing.

DIAGNOSTICS

before and after mutually exclusive

Call "fetch" with one of either before or after, but not both.

either before or after needed

Call "fetch" with one of either before or after.

XML parsing failed: %s

The server returned broken XML that the parser could not understand. Most likely, it did not return XML at all, but something different.

POST request to %s failed: %s

Various things can go wrong during a HTTP request: DNS lookup failures, hosts that do not accept connections, Not Found status messages (check the URL for mistakes or typos) and various other HTTP failures beyond your control. If you get a read timeout, increase the "ua_timeout".

From Params::Validate: new, fetch, blame die if they are passed assorted rubbish as parameters.

From DateTime::Format::ISO8601: fetch dies if it is passed an invalid date format.

CONFIGURATION AND ENVIRONMENT

Mediawiki::Blame requires no configuration files or environment variables.

DEPENDENCIES

Core modules: Carp

CPAN modules: Algorithm::Annotate, Class::Spiffy, DateTime, DateTime::Format::ISO8601, LWPx::ParanoidAgent, Params::Validate, Regexp::Common, Readonly, XML::Twig

INCOMPATIBILITIES

None reported.

BUGS AND LIMITATIONS

No bugs have been reported.

Please report any bugs or feature requests to bug-mediawiki-blame@rt.cpan.org, or through the web interface at http://rt.cpan.org.

TO DO

Suggest more future plans by filing a bug.

AUTHOR

Lars Dɪᴇᴄᴋᴏᴡ <daxim@cpan.org>

LICENCE AND COPYRIGHT

Copyright © 2007-2009, Lars Dɪᴇᴄᴋᴏᴡ <daxim@cpan.org>.

This module is free software; you can redistribute it and/or modify it under the same terms as Perl 5.8.

DISCLAIMER OF WARRANTY

BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE »AS IS« WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION.

IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

SEE ALSO

The Levitation project http://levit.at/ion duplicates some features of this module.

Mediawiki::Blame::Revision, Mediawiki::Blame::Line