The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

WWW::Kontent::Request - Kontent request object

SYNOPSIS

        # Eventually, when Pugs supports this sort of thing
        method adapter(WWW::Kontent::Request $request where { .mode eq 'view' }) {
                return WWW::Kontent::Parser::parse(
                        $.attributes<kiki:content>,
                        $.attributes<kiki:type>,
                        $request
                );
        }

DESCRIPTION

WWW::Kontent::Request represents a request for a page. It is used to:

  • Store and organize information which may be used and modified over the lifetime of the request.

  • Execute the overall store-driver-renderer control flow.

  • Carry information between the various components.

  • Parse and resolve paths.

Attributes

pagepath

WWW::Kontent::Path object representing the path being resolved in this request.

mode

Contains the name of the rendering mode, such as "view" (the default), "history" and "edit". Drivers, adapters, and renderers are all concerned with these modes. This actually retrieves it from the object in path.

format

Contains the name of the page's format, such as "html" (the default), "xml", "pdf", or "jpg". This field is mostly the purview of the renderer (and is used to select the renderer), but may be of interest to certain adapters as well, such as those used to store images. This actually retrieves it from the object in path.

parameters

Contains a hash of parameters to the page. Parameters are used to communicate information to drivers besides the mode and format; they usually correspond to HTTP POST or GET parameters.

nested

Indicates the subrequest depth. Zero indicates that this object is the top-level request; one indicates it is a first-level subrequest; and so on. Many renderers will omit "chrome" such as headers or navigation tools in a subrequest, but drivers and adapters may be interested in this as well.

type

Contains the MIME type of the final output; as such, this is usually set by the renderer, but sometimes the adapter handles this instead. HTTP supervisors will typically output this value as the Content-Type header.

status

Contains the HTTP status code that should be returned to the browser; defaults to 200.

root

Contains the store's root page.

page
revision

After a call to .resolve, contains the page and revision so resolved. These fields should usually be used only by supervisors; the request object will arrange for renderers and page classes to receive their own references to the revision object.

renderer

Contains the renderer to be used for this request.

session

Contains a WWW::Kontent::Session object for the current session.

userpath

Contains the path to the current user object. This is retrieved from the session during object construction.

user

Contains the current revision of the user page.

Constructors

WWW::Kontent::Request.new(:root($store_root), :path("/foo/bar[42].atom{edit}"), :sid($session_id), :parameters({ baz => 'quux' }));

The normal constructor for a Request object; usually called only from the supervisor. Parses path if provided to acquire an address.

$request.subrequest($path, { :param1<value1, :param2<value2> })>

Constructs a subrequest with the same format and mode as the current request, but the parameters and path provided.

Note that the same renderer class will be used as $request, even if a different format is provided. The reason for this will become clear through deep meditation on exactly what the Kolophon code {{/images/foo.jpg}} should do in an HTML renderer.

Methods

resolve_all

Tells the objects in the userpath and pagepath attributes to resolve themselves; in the process, fills the user, page, and revision attributes.

go

Convenience method which calls .resolve, then the revision's driver, and finally the renderer. Returns a string containing the renderer's output. It also handles restarts and other inner exceptions.

c<grok_link>($path)

Resolves a partial path (one that may be relative to the current page or any of its parents, and whose final component may be the title of a page rather than its name). Returns an array of Revision objects which match the path in question.

trigger_magic('pre', 'resolve', $foo, $bar)

Triggers any magic hooks associated with the event in question. The last data argument is returned, and may be modified by the magic hooks.

SEE ALSO

WWW::Kontent

4 POD Errors

The following errors were encountered while parsing the POD:

Around line 35:

=back doesn't take any parameters, but you said =back 4

Around line 114:

=back doesn't take any parameters, but you said =back 4

Around line 193:

=back doesn't take any parameters, but you said =back 4

Around line 354:

=back doesn't take any parameters, but you said =back 4