KiokuX::Model::Role::Annotations - A role for adding annotations to objects in a KiokuDB database.
package MyApp::Model; use Moose; extends qw(KiokuX::Model); with qw(KiokuX::Model::Role::Annotations); # any object can be an annotation for another object $model->add_annotations_for( $obj => $annotation ); # no need to specify the annotated object if the annotation does # KiokuX::Model::Role::Annotations::Annotation $model->add_annotations($annotation_object); # get annotations my @annotations = $model->annoations_for($obj);
This role provides a mechanism to annotate objects with other objects.
Add annotations for an object.
The first form requires the annotation objects to do the role KiokuX::Model::Role::Annotations::Annotation.
The second form has no restrictions on the annotation objects, but requires the key object to be specified explicitly.
Remove the specified annotations.
Returns true if the object has been annotated.
Returns a list of all annotations for the object.
The role is actually parameterizable.
Defaults to annotations. This string is prepended to the annotated object's ID and used as the key for the annotation set for that object.
annotations
Dfeaults to the value of namespace.
namespace
Used to provide the names of all the methods (the string annotations in the above methods would be replaced by the value of this).
Defaults to object_to_id (see KiokuDB).
object_to_id
The function to map from an object to an ID string, can be a code reference or a string for a method name to be invoked on the model object.
The default implementation concatenates namespace, a colon and id_callback to provide the key of the set.
id_callback
If the key object is actually a string, the string is used as is.
Can be overridden with a method name to be invoked on the model, or a code reference.
1 POD Error
The following errors were encountered while parsing the POD:
You forgot a '=back' before '=head1'
To install KiokuX::Model::Role::Annotations, copy and paste the appropriate command in to your terminal.
cpanm
cpanm KiokuX::Model::Role::Annotations
CPAN shell
perl -MCPAN -e shell install KiokuX::Model::Role::Annotations
For more information on module installation, please visit the detailed CPAN module installation guide.