NAME

PurpleWiki::Sequence - Generates sequences for node IDs

SYNOPSIS

  use PurpleWiki::Sequence;

  my $dataDir = '/wikidb';
  my $url = 'http://purplewiki.blueoxen.net/cgi-bin/wiki.pl';

  my $sequence = new PurpleWiki::Sequence($dataDir);
  $sequence->getNext;

DESCRIPTION

Generates IDs in base 36 (10 digits + 26 uppercase alphabet) for use as node IDs.

METHODS

new($datadir, [remotesequence])

Constructor. $datadir contains the Wiki configuration/database directory. There, PurpleWiki::Sequence stores the last used ID and an index of node IDs to fully qualified URLs (used by Transclusion.pm).

Optionally takes a second argument which points to a URL from which nids can be retrieved. This is an experimental feature and should not be relied upon to stick around.

getNext($url)

Returns the next ID, increments and updates the last used ID appropriately. If $url is passed, also updates the NID to URL index.

getURL($nid)

Returns the URL in the index associated with the given NID, or undef if there isn't one.

AUTHORS

Chris Dent, <cdent@blueoxen.org>

Eugene Eric Kim, <eekim@blueoxen.org>

SEE ALSO

PurpleWiki::Parser::WikiText, PurpleWiki::Transclusion.