Text::Summary::MediaWiki - Produce a short summary from MediaWiki markup


Text-Summary-MediaWiki documentation  | view source Contained in the Text-Summary-MediaWiki distribution.

Index


NAME

Top

Text::Summary::MediaWiki - Produce a short summary from MediaWiki markup

SYNOPSIS

Top

    use Text::Summary::MediaWiki;

    my $s = Text::Summary::MediaWiki->new(
      url => "http://en.wikipedia.org/wiki/", # Trailing / is required
      get => sub {
        my($url) = @_;
        # return markup of page at URL
      });

    print $s->get("Perl");

DESCRIPTION

Top

Produces short summaries from MediaWiki markup. This has been mostly tested with Wikipedia but this should work for any wiki using MediaWiki markup.

Note that making requests to Wikipedia for each page is considered rather rude, if you need a high query volume use a local database dump (I use Parse::MediaWikiDump).

METHODS

Top

new

The new method takes a parameter hash containing the following:

* url

Required, the URL used to identify the instance of MediaWiki to produce summaries for. This should be the base path to the instance.

* get

Required, a callback to fetch the actual text, this is required so the code can get additional pages if redirected.

* redirect_limit

Optional, a limit for redirection, default 5.

* approx_length

Optional, approximate length of summary to produce (in characters), default 200.

get

Given the name of an article fetches it and generates a summary.

If called in array context returns the summary and the URL it can be found at.

format

Generates a summary from text in MediaWiki format.

AUTHOR

Top

David Leadbeater <dgl at dgl.cx>

COPYRIGHT & LICENSE

Top


Text-Summary-MediaWiki documentation  | view source Contained in the Text-Summary-MediaWiki distribution.