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. The documents are scanned for valid RDF metadata which, if present, will be made available for use in the system. [Note that for metadata, currently only SVG documents are supported.]

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.

Note: Currently this function is unimplemented, and simply returns a list of all document IDs.

properties()

Gets or updates the properties for a given document id. Returns undef on error, such as if an invalid document id is given.

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

Note: Currently this is unimplemented.

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.

The following states are allowed:

 new
 open
 accepted
 rejected
 broken
 retired

keyword_add($doc_id, @keywords)

Adds a given keyword or list of keywords to the document's metadata. Returns undef if the keywords could not be added; the error can be retrieved from get_error().

Leading and trailing spaces are stripped. Any ';' characters in the keywords will be converted to ',' characters. The keywords are also lowercased.

Note: Currently this does not add the keywords to the original SVG file, only the metadata in the document system.

keyword_remove()

Removes one or more keywords from the document metadata, if present.

Note: Currently this does not actually alter the SVG file itself.