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 - A web service for managing documents in a central repository.

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

Document::Manager 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()

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.

Returns the new ID number of the document added, or undef if failed.

checkin()

Commits a new revision to the document. Returns the document's new revision number, or undef if failed.

query()

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

revert()

Reverts the given document to a prior revision number

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 updates 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.