Andrew Sterling Hanenkamp > Contentment-0.011_033 > Contentment::Node::Revision

Download:
Contentment-0.011_033.tar.gz

Dependencies

Annotate this POD

Module Version: 0.06   Source  

NAME ^

Contentment::Node::Revision - Nodes with revisions

DESCRIPTION ^

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.

NODE ATTRIBUTES

In addition to the node attributes supported by Contentment::Node, Contentment::Node::Revision objects also support these fields:

updated_on

The date the revision was created or last updated.

updated_by

The username of the user that created or last updated the revision.

comment

A comment describing the revision.

SPECIAL METHODS

The following methods are defined for node revision objects:

$revision = RevisionClass->create(\%args)

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.

This creates a new node and a new revision under that node according the given %args.

$cloned_revision = $revision->clone(\%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.

$revision->trash

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.

AUTHOR ^

Andrew Sterling Hanenkamp, <hanenkamp@cpan.org>

LICENSE AND COPYRIGHT ^

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.

syntax highlighting: