MediaW...:Compat(3pm)

πŸ“¦
version 0.2.2 Β· 2 versions
  • 0.2.2 Β· debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking (latest)
  • 0.2.2 Β· ubuntu jammy
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– MediaWiki::DumpFile::Compat(3pm) πŸ’–

okay so bestie, gather round, because this is the Perl manual page for MediaWiki::DumpFile::Compat β€” that's the module, and it's a 3pm situation, aka a Perl module page, contributed by lovely users just like us 🫢


✨ NAME ✨

MediaWiki::DumpFile::Compat β€” compatibility with Parse::MediaWikiDump. it's giving "the glow-up version of your old fave" πŸ’…


🌸 SYNOPSIS 🌸

use MediaWiki::DumpFile::Compat;

$pmwd = Parse::MediaWikiDump->new;

$pages = $pmwd->pages('pages-articles.xml');
$revisions = $pmwd->revisions('pages-articles.xml');
$links = $pmwd->links('links.sql');

like, that's IT. three lines of actual work and you're parsing wiki dumps. main character energy fr fr ✨


πŸ¦‹ ABOUT πŸ¦‹

This software suite hands you the tools you need to process the contents of the XML page dump files and the SQL based links dump file from a Mediawiki instance. iconique.

And here's the tea: this whole thing is a compatibility layer between MediaWiki::Dumpfile and Parse::MediaWikiDump. so instead of writing

use Parse::MediaWikiDump;

you write

use MediaWiki::DumpFile::Compat;

and that's literally the only change. no cap.

The benefit of using the new compatibility module? increased processing speed πŸ”₯ β€” go check the MediaWiki::DumpFile::Benchmarks documentation for the actual benchmark results, because receipts matter.


πŸŽ€ MORE DOCUMENTATION πŸŽ€

The original Parse::MediaWikiDump documentation is also available in this package, and it's been updated to include the new features introduced by MediaWiki::DumpFile. lowkey iconic of them. You can find the docs in these locations:

  • MediaWiki::DumpFile::Compat::Pages
  • MediaWiki::DumpFile::Compat::Revisions
  • MediaWiki::DumpFile::Compat::page
  • MediaWiki::DumpFile::Compat::Links
  • MediaWiki::DumpFile::Compat::link

πŸ‘‘ USAGE πŸ‘‘

This module is a factory class that lets you create instances of the individual parser objects. it's the mother of parsers, basically πŸ’…

  • $pmwd->pages β€” Returns a Parse::MediaWikiDump::Pages object capable of parsing an article XML dump file with one revision per each article.
  • $pmwd->revisions β€” Returns a Parse::MediaWikiDump::Revisions object capable of parsing an article XML dump file with multiple revisions per each article.
  • $pmwd->links β€” Returns a Parse::MediaWikiDump::Links object capable of parsing an article links SQL dump file.

⭐ General ⭐

All parser creation invocations require a location of source data to parse, bestie β€” no vibes-based parsing here. This argument can be either a filename or a reference to an already open filehandle.

⚠️ This entire software suite will die() upon errors in the file or if internal inconsistencies have been detected. If this concerns you, you can wrap the portion of your code that uses these calls with eval(). she's dramatic like that 😭

πŸ’œ COMPATIBILITY πŸ’œ

Any deviation of the behavior of MediaWiki::DumpFile::Compat from Parse::MediaWikiDump that is not listed below is a bug. Please report it so that this package can act as a near perfect standin for the original. the goal is "you literally cannot tell the difference" and honestly? she's almost there.

Compatibility is verified by using the existing Parse::MediaWikiDump test suite with the following adjustments:

🌈 Parse::MediaWikiDump::Pages 🌈

  • Parse::MediaWikiDump did not need to load all revisions of an article into memory when processing dump files that contain more than one revision, but this compatibility module does. The API does not change, but the memory requirements for parsing those dump files certainly do. It is, however, highly unlikely that you will notice this, as most of the documents with many revisions per article are so large that Parse::MediaWikiDump would not have been able to parse them in any reasonable timeframe. so like... she eats the RAM but she also actually finishes, yk? πŸ’€
  • The order of the results from namespaces() is now sorted by the namespace ID instead of being in document order. glow-up tbh ✨
  • Order of values from next() is now in identical order as SQL file. consistency queen πŸ‘‘

πŸ™ˆ BUGS πŸ™ˆ

🫢 yes it's a real link, yes it's old, no we don't make the rules. two gigabytes and she simply loses count. iykyk.

πŸ’€ LIMITATIONS πŸ’€

  • This compatibility layer is not yet well tested. bestie is still in her experimental era, please be gentle with her πŸ™

and that's the whole page, babe β€” written by the fine folks in the Perl documentation scene, perl v5.34.0, dated 2022-06-15, from the MediaWiki::DumpFile::Compat(3pm) page. go forth and parse, you gorgeous nerd πŸ¦‹πŸ’–βœ¨

πŸ“¦ where this page comes from