NAME
Angerwhale::Content::Filesystem::Item - data and metadata stored on disk representing an Angerwhale::Content::Item
SYNOPSIS
my $base = '/path/to/some/files';
my $root = $base;
my $file = '/path/to/some/files/an article';
my $item = Angerwhale::Content::Filesystem::Item->new
({ root => $root,
base => $base,
file => $file,
});
my $data = $item->data;
my $meta = $item->metadata;
my $kids = $item->children;
DESCRIPTION
Reads the basic content needed for an article or comment from the filesystem.
METHODS
new($hashref)
Create a new instance. Hashref must contain:
- root
-
The root directory, where the "articles" live. Must be a directory.
- file
-
Path to this file. Must be a file.
store_attribute
Use File::Attributes to store metadata back to disk
store_data
Store data to disk
_children
[private] Get the children of this item. See SUPER::children for public access.
children
Return (or set; INTERNAL USE ONLY) reference to the list of children.
add_tag(@tags)
Tag item with tags in @tags
.
add_comment($title, $body, $userid, $file_format)
Attaches a comment to this Item.
Arguments are:
- title
-
The title of this comment. Any characters are allowed.
- body
-
The main text of this comment, formatted in
$file_format
. - userid
-
The (8-byte) "nice_id" of the comment poster.
- format
-
The file format in which
body
is encoded. Examples: html, pod, text, wiki. (See Angerwhale::TODO::Formatter.)