The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Statocles::Store - A repository for Documents and Pages

VERSION

version 0.026

DESCRIPTION

A Statocles::Store reads and writes documents and files (mostly pages).

This class handles the parsing and inflating of "document objects".

Frontmatter Document Format

Documents are formatted with a YAML document on top, and Markdown content on the bottom, like so:

    ---
    title: This is a title
    author: preaction
    ---
    # This is the markdown content
    
    This is a paragraph

ATTRIBUTES

path

The path to the directory containing the documents.

documents

All the documents currently read by this store.

METHODS

read_documents()

Read the directory path and create the document objects inside.

read_document( path )

Read a single document in either pure YAML or combined YAML/Markdown (Frontmatter) format and return a datastructure suitable to be given to Statocles::Document.

write_document( $path, $doc )

Write a document to the store. Returns the full path to the newly-updated document.

The document is written in Frontmatter format.

read_file( $path )

Read the file from the given path.

has_file( $path )

Returns true if a file exists with the given path.

NOTE: This should not be used to check for directories, as not all stores have directories.

write_file( $path, $content )

Write the given content to the given path. This is mostly used to write out page objects.

coercion

Class method to coerce a string representing a path into a Statocles::Store object. Returns a subref suitable to be used as a type coercion in an attriute.

AUTHOR

Doug Bell <preaction@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2014 by Doug Bell.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.