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 $repository = new Document::Manager;

my $doc_id = $repository->add($filename);

my $filename = $repository->checkout($dir, $doc_id);

DESCRIPTION

This module provides a simple interface for managing a collection of revision-controlled documents.

FUNCTIONS

new($confighash)

Establishes the repository interface object. You must pass it the location of the repository, and optionally can indicate what permissions to use (0600 is the default).

If the repository already exists, indicate where Document::Manager should start its numbering (e.g., you may want to store this info in a config file or something between invokations...)

get_error()

Retrieves the most recent error message

repository_path($doc_id, $rev_number)

Returns a path to the location of the document within the repository repository.

add()

Adds a new document to the repository. Establishes a new document ID and returns it.

If you wish to simply register the document ID without actually uploading a file, send a zero-byte temp file.

Specify a $revision if you want the document to start at a revision number other than 0.

Returns undef on failure. You can retrieve the error message by calling get_error().

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 copied into $dir on success. If there is an error, it returns undef. The error message can be retrieved via get_error().