NAME
WWW::Kontent::Foundation - Abstract base classes for Kontent
SYNOPSIS
use WWW::Kontent::Fondation;
#A store might do this:
class MySavedPage is WWW::Kontent::SavedPage { ... }
class MyDraftRev is WWW::Kontent::DraftRevision { ... }
# Similarly:
role MyClass is WWW::Kontent::Class { ... } #eventually--curently a class, not a role
class MyRenderer is WWW::Kontent::Renderer { ... }
DESCRIPTION
WWW::Kontent::Foundation contains abstract bases for several important classes and roles. It also pulls in WWW::Kontent::Store, which defines the six classes needed to represent pages and revisions; see that module for more niformation on those classes.
WWW::Kontent::Renderer
This base class represents a page renderer. Renderers have only one method, render
, which takes a request object and returns the page's content; it is also expected to set the request object's type
attribute to an appropriate value. In addition, WWW::Kontent::Renderer
has a public revision
attribute containing the revision that should be rendered; this attribute is managed by WWW::Kontent::Renderer
and WWW::Kontent::Request
for the benefit of the renderer.
WWW::Kontent::Class
This is the base class of a Kontent page class. It contains a revision
attribute containing the revision whose class this is; this attribute is managed by WWW::Kontent::Class
and WWW::Kontent::Request
for the benefit of the page class.
Page classes must implement two methods, driver
and adapter
; see "WWW::Kontent::Revision" for information on their signatures and use. They may additionally implement the methods resolve
and create
; the default implementations dispatch to the page object's default_resolve
and default_create
methods, respectively. It's very common for a page class to capture the return value from this base class's create
method and set some attributes, usually the kontent:class
attribute.
To avoid a rather annoying Pugs bug, the four methods currently have an underscore appended to their names; that is, they're named driver_
and so on.