man Zim::Repository () - A wiki repository

NAME

Zim::Repository - A wiki repository

SYNOPSIS

        use Zim::Repository;

        my $repo = Zim::Repository->new($root_dir);
        my $page = $repo->load_page('Home');

DESCRIPTION

This class defines the public interface to the document repository as used by zim(1). By default it represents filesystem based repositories, but it can be overloaded for more abstract models. It uses Zim::Page objects as data containers.

METHODS

Public Methods

The following methods can be used by the GUI.

new(NAMESPACE, DIR)
Simple constructor. DIR is the root directory of the repository. NAMESPACE is the namespace that maps to that directory. For the toplevel repository leave NAMESPACE empty.
list_pages(N)
Lists pages in NAMESPACE. Sub-namespaces have a trailing ':' in the listing.
page_exists(PAGE_NAME)
Returns TRUE when there is an existing page under this name.
load_page(PAGE_NAME)
Returns an object of the type Zim::Page. If the page you requested doesn't exist you get an object with it's status set to new.
save_page(PAGE)
Saves the data for the page object PAGE. Note that the page object could belong to an other repository originally.
move_page(OLD_NAME, NEW_NAME)
Moves a page from OLD_NAME to NEW_NAME. You can use an object instead of OLD_NAME, in this case the object will also be updated to reflect the new location.
delete_page(PAGE)
Deletes a page. PAGE can be either a page name or a page object. This method finds a case-sensitive name corresponding to the user supplied page name NAME. The page does not need to exist. More generally this method is used to find a canonical page name corresponding to a potential non-canonical name that is entered by the user. This method may do all kinds of cleanups. This method is used when resolving links. In list context the page name can be followed with some data the may be given to the repository's CWload_page(). This is used for repository specific optimizations. TODO stable api for this

Private Methods

These methods are specific to filesystem based repositories and should therefor never be called directly from the GUI.

filename(PAGE, DIR)
Gives the filename corresponding to a page name. DIR is a boolean that can be set to tell that PAGE is expected to be a directory, which is useful when looking up a namespace. This behaviour is also triggered if the page name ends with ':'. In list context the filename and directory for PAGE are returned.
pagename(FILE)
Returns the page name corresponding to FILE. FILE does not actually need to exist and can be a directory as well as a file.

BUGS

Please mail the author if you find any bugs.

AUTHOR

Jaap Karssenberg || Pardus [Larus] <pardus@cpan.org>

Copyright (c) 2005 Jaap G Karssenberg. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

SEE ALSO

Zim, Zim::Page