Contentment::Node::Revision - Nodes with revisions
This is the class to subclass if you want to create a node object. Once your class subclasses this object, extends the Oryx schema as desired, and creates any other methods it needs, it will be a full node object. This is really as simple as this:
package Foo; use strict; use warnings; use base qw( Contentment::Node::Revision ); our $schema = { attributes => [{ name => 'my_field', type => 'String', }], }; 1
And you are done. You'll probably want to add additional methods to make your node more functional if you want to be reachable by the resolver hook handler defined in Contentment::Node. However, that only requires two more method definitions. See "NODE RESOLVER" in Contentment::Node for further details.
In addition to the node attributes supported by Contentment::Node, Contentment::Node::Revision objects also support these fields:
Contentment::Node::Revision
The date the revision was created or last updated.
The username of the user that created or last updated the revision.
A comment describing the revision.
The following methods are defined for node revision objects:
This is slightly different from the typical Oryx::Class create() method. This method actually creates two objects rather than just one and also does some additional setup.
create()
This creates a new node and a new revision under that node according the given %args.
%args
This method operates in pretty much the exact same way as the create() method, except that it duplicates the fields in the original when not modified in the passed %args. This will attach the new revision to the same node as the original.
The clone will become the current revision for the current node collection.
This is very similar to delete() except that nothing is removed from the database. Okay... so it's nothing like delete(). It removes the object from the current node collection.
delete()
Andrew Sterling Hanenkamp, <hanenkamp@cpan.org>
Copyright 2005 Andrew Sterling Hanenkamp <hanenkamp@cpan.org>. All Rights Reserved.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
To install Contentment, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Contentment
CPAN shell
perl -MCPAN -e shell install Contentment
For more information on module installation, please visit the detailed CPAN module installation guide.