WWW::Kontent::Foundation - Abstract base classes for Kontent
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 { ... }
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.
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.
render
type
WWW::Kontent::Renderer
revision
WWW::Kontent::Request
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.
WWW::Kontent::Class
Page classes must implement three methods, driver, adapter, and modelist; 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.
driver
adapter
modelist
resolve
create
default_resolve
default_create
kontent:class
To avoid a rather annoying Pugs bug, the five methods currently have an underscore appended to their names; that is, they're named driver_ and so on.
driver_
WWW::Kontent, WWW::Kontent::Store
To install WWW::Kontent::Foundation, copy and paste the appropriate command in to your terminal.
cpanm
cpanm WWW::Kontent::Foundation
CPAN shell
perl -MCPAN -e shell install WWW::Kontent::Foundation
For more information on module installation, please visit the detailed CPAN module installation guide.