- COPYRIGHT AND LICENSE
Statocles::Store::File - A store made up of plain files
This store reads/writes files from the filesystem.
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
The path to the directory containing the documents.
An array of file extensions that should be considered documents. Defaults to "markdown" and "md".
All the documents currently read by this store.
Clear the cached documents in this Store.
Read the directory
path and create the document objects inside.
Read a single document in Markdown with optional YAML frontmatter.
Parse a document with YAML frontmatter. $from is a string identifying where the content comes from (a path or other identifier). $content is the content to parse for frontmatter.
Write a document to the store. Returns the full path to the newly-updated document.
The document is written in Frontmatter format.
Returns true if the path looks like a document path (matches the "document_extensions").
Read the file from the given
Returns true if a file exists with the given
NOTE: This should not be used to check for directories, as not all stores have directories.
Returns an iterator that, when called, produces a single path suitable to be passed to read_file.
Available options are:
include_documents - If true, will include files that look like documents. Defaults to false.
Open the file with the given path. Returns a filehandle.
The filehandle opened is using raw bytes, not UTF-8 characters.
Write the given
content to the given
path. This is mostly used to write out page objects.
content may be a simple string or a filehandle. If given a string, will write the string using UTF-8 characters. If given a filehandle, will write out the raw bytes read from it with no special encoding.
Doug Bell <firstname.lastname@example.org>
This software is copyright (c) 2015 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.