The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Document::Manager

SYNOPSIS

my $dms = new Document::Manager;

$dms->checkout($dir, $doc_id, $revision);

$dms->add(); $dms->checkin(); $dms->query(); $dms->revert(); $dms->lock(); $dms->unlock(); $dms->properties(); $dms->stats();

print $dms->get_error();

DESCRIPTION

This module provides a simple interface for managing a collection of revision-controlled documents. A document is a collection of one or more files that are checked out, modified, and checked back in as a unit. Each revision of a document is numbered, and documents can be reverted to older revisions if needed. A document can also have an arbitrary set of metadata associated with it.

FUNCTIONS

new($confighash)

Creates a new document manager object.

get_error()

Retrieves the most recent error message

checkout()

Checks out a copy of the document specified by $doc_id, placing a copy into the directory specified by $dir. By default it will return the most recent revision, but a specific revision can be retrieved by specifying $revision.

Returns the filename(s) copied into $dir on success. If there is an error, it returns undef. The error message can be retrieved via get_error().

add()

Takes a hash of filenames => content pairs, and inserts each into the dms as a separate document.

checkin()

Commits a new revision to the document. Returns the document's new revision number.

query()

Returns a list of documents with property constraints meeting certain conditions.

# TODO

revert()

Reverts the given document to a prior revision number

# TODO

lock()

Locks a document for the given user for a specified period of time

unlock()

Unlocks a document, if it is locked

properties()

Gets or sets the properties for a given document id

stats()

Returns a hash containing statistics about the document repository as a whole, including the following:

* Stats from Document::Repository::stats() * Number of pending documents * Number of documents new today * Number of authors

state(doc_id[, state[, comment]])

Gets or sets the state of document in the system. Returns undef if the specified doc_id does not exist, or does not have a valid state set.

Valid states include:

Unreviewed ---> Rejected \ +-> Accepted ---> Broken \ +-> Retired