Reference

Zim::Repository(3pm)

Zim::Repository - A wiki repository

        use Zim::Repository;

        my $repo = Zim::Repository->new(undef, ':', $dir);
        my $page = $repo->get_page('Home');

This class defines the public interface to the document repository as used by zim(1). It acts as a dispatcher that manages one or more child objects to handle page requests. It also adds some tests and thus tries to isolate the handlers from errors in the GUI. The interface which child objects should support is defined in Zim::Repository::Base.
Public Methods The following methods can be used by the GUI. Constructor. PARENT can be a parent repository object or undef. NAMESPACE is the prefix for all pages managed by this repository.

DIR is the root namespace of the repository and might contain a onfig file. Returns a hash with config options. Saves the config to disk. Returns the base directory for files.

The "base" directories for individual pages should either be the same as this directory or a subdirectory of it. Returns boolean whether NAMESPACE exists. Lists pages in NAMESPACE. Sub-namespaces have a trailing ':' in the listing.

If a page is not present in this list that does not mean that it doesn't exists. This list is used for hierarchical views of the page structure; not all repositories need to support a hierarchical order. Returns an object of a class inheriting from Zim::Page. When you ask for a page that doesn't exists yet, you should get a new object. In case it is not possible to create the page in question "undef" is returned. Like "get_page()" but now expecting NAME to be user input, so NAME is sanitized first. Returns a namespace string. Used to sanitize user input. Copy page SOURCE to TARGET. Both arguments can be either page names or objects. Returns the (new) TARGET object. Move page SOURCE to TARGET. Both arguments can be either page names or objects. Returns the (new) TARGET object. Delete PAGE. PAGE can be either a page name or a page object. TODO stable api for this using Zim::Selection

Results are given as arguments to CALLBACK in the form "[PAGE, SCORE]". TODO stable api for this
Utility Methods These methods can be used by the interface but do not need to be reproduced in child handlers. Returns a Zim::Selection object for PAGES. Both PAGES and OPT are optional arguments. This will connect a new child object to this repository under a certain namespace. CHILD is a class name implementing the repository interface. The class will be looked for in "Zim::Repository::". All remaining arguments will be passed on to the constructor of the object. Returns an url for an interwiki link with interwiki name KEY and page PAGE. Lookup for names is case in-sensitive. Checks to see if the path for FILE can be made relative to the path for PAGE. If PAGE is undef tries to make relative to the repository. Returns either the relative or the absolute path. Splits a page into multiple pages in the like-named namespace. Splits the page at headings up to level LEVEL (1..5 default 1).

This method can only be used for page objects that support the "formatted" interface like Zim::Page::Text. TODO - work in progress
Class Methods These methods can be called as "Zim::Repository->method(...)". Returns a path for a repository with NAME or undef if the repository is unknown. The lookup is case in-sensitive. Returns a file name or undef.

TODO: This method should go to either Zim::Template or Zim::Formats when these are created. Returns a hash with name => filename pairs of available templates. Used for exporting.

TODO: This method should go to either Zim::Template or Zim::Formats when these are created. Please mail the author if you find any bugs. Jaap Karssenberg || Pardus [Larus] <[email protected]> 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. Zim, Zim::Repository::Files, Zim::Repository::DBI