NAME
Articulate::Item - represent an item
SYNOPSIS
Articulate::Item->new( {
meta => {},
content => 'Hello, World!',
location => 'zone/public/article/hello-world',
} );
# Construction defaults to item if no better option is available
Articulate::Construction->construct( { ... } );
An item is a simple storage class for any sort of item which. Items have metadata, content, and a location.
Although it is acceptable to create items using the new
class method, it is recommended that you construct items using Articulate::Construction, which will be able to pick an appropriate subclass of item to construct based on the argument you supply, if you have configured it to do so. Such a subclass can have semantically appropriate methods available (see _meta_accessor
below for information on how to create these).
ATTRIBUTES
location
Returns the location of the item, as a location object (see Articulate::Location). Coerces into a location using Articulate::Location::loc
.
meta
Returns the item's metadata, as a hashref.
content
Returns the item's content. What it might look like depends entirely on the content. Typically this is an unblessed scalar value, but it MAY contain binary data or an Articulate::File object.
METHOD
_meta_accessor
# In a subclass of Item
sub author { shift->_meta_accessor('schema/article/author')->(@_) }
# Then, on that subclass
$article->author('user/alice');
$article->author;
Uses dpath_set or dpath_get from Articulate::Syntax to find or assign the relevant field in the metadata.