WWW::Kontent::Store - Base classes for Kontent stores
class MySavedPage is WWW::Kontent::SavedPage { ... } class MyDraftPage is WWW::Kontent::DraftPage { ... } class MySavedRev is WWW::Kontent::SavedRevision { ... } class MyDraftRev is WWW::Kontent::DraftRevision { ... } say "$page.path() ('$page.cur.attributes<kontent:title>') has {+$page.revisions} revisions.";
WWW::Kontent::Store contains the classes defining Kontent pages and revisions. The classes in this module are abstract, and are usually inherited from by store modules.
This is a base class for a Kontent page. A store will not usually derive directly from this class; rather, it will derive its child classes, SavedPage and DraftPage.
SavedPage
DraftPage
name
Returns the name of the page. In DraftPages, this should be writable. Store authors must override this method to give it a body.
parent
Returns the page's parent page. Note that this must be the parent as seen by Kontent, which may be different from the parent reflected in the store if a special page class is bridging between two stores. Hence, it's probably best to have parent pages pass themselves into the constructors of their children. Store authors must override this method to give it a body.
path
Returns the path from the root page to this page. This method has a default implementation using name and parent, but store authors may want to override it for efficiency.
SavedPage represents a page retrieved from whatever backing store the store module interfaces with. SavedPages are basically immutable.
revisions
Returns an array of SavedRevision objects representing the page's revisions.
cur
Returns a SavedRevision object representing the page's current revision. This method defaults to simply calling revisions and extracting the last element, but store authors may want to override it with a more efficient implementation.
children
Returns an array containing the names of the page's children.
XXX should probably be one of the default_ methods
default_resolve
Finds the child page of the given name and returns it. Page classes will typically use this method to resolve a page, but may override it to implement a bridge.
default_create
Creates a child page of the given name and returns a draft of its first revision. Page classes will typically use this method to resolve a page, but may override it to implement a bridge or simply set a default page class.
pool
Returns a pool in the current store with the module name $module.
DraftPages represent a page which has been created in the Kontent store, but has not yet been committed. Each DraftPage has a single DraftRevision; committing the DraftRevision should also save the DraftPage. The name field in a DraftPage should be mutable.
draft_revision
Returns the draft revision associated with this draft page.
page
Returns the page this revision belongs to.
attributes
Returns a hash containing all attributes of this revision.
revno
Returns the revision number of this revision; this number is 1-based, increasing by 1 in each revision.
driver
Calls the page class's driver method.
A class's driver should implement any complex behavior the page class requires, such as database updates, querying for information, or complex calculations. A WWW::Kontent::Request object must be passed in to this method.
adapter
Calls the page class's adapter method.
The adapter is called by the renderer when it wants to retrieve the page's content; it should return a WWW::Kontent::Skeleton object containing content appropriate for the current mode. A WWW::Kontent::Request object must be passed in to this method.
modelist
Calls the page class's modelist method. The modelist method should return an array containing all the modes supported by the class.
Represents a revision retrieved from the database. Store authors should write a class which inherits from this. Its attributes should be assumed to be immutable.
revise
Returns a Draft object with the same attributes as this revision, except with the rev: attributes omitted. The draft should have the revision number passed into this method.
rev:
resolve
Calls the page class's resolve method, which by default calls the page's default_resolve method. This method takes a page name and returns the child page with that name.
create
Calls the page class's create method, which by default calls the page's default_create method. This method takes a page name and returns a DraftPage object for it. The DraftPage's revision must be committed before it will appear in the backing store.
This class represents an uncommitted draft revision. Store authors should inherit from this class.
commit
Writes the draft revision (and the page, if it is also a draft) into the backing store.
This class represents a pool of unversioned data tied to a particular store. Store authors should inherit from this class.
WWW::Kontent
6 POD Errors
The following errors were encountered while parsing the POD:
=back doesn't take any parameters, but you said =back 4
To install WWW::Kontent::Store, copy and paste the appropriate command in to your terminal.
cpanm
cpanm WWW::Kontent::Store
CPAN shell
perl -MCPAN -e shell install WWW::Kontent::Store
For more information on module installation, please visit the detailed CPAN module installation guide.