NAME
WWW::Page - XSLT-based and XML-configured website engine
SYNOPSIS
mod_perl custom handler
use WWW::Page;
my $page = new WWW::Page({
'xslt-root' => "$ENV{DOCUMENT_ROOT}/../data/xsl",
'lib-root' => "$ENV{DOCUMENT_ROOT}/../lib",
'timeout' => 30,
});
sub handler {
my $r = shift;
$page->run(
source => "$ENV{DOCUMENT_ROOT}/index.xml",
request_uri => $ENV{REQUEST_URI}
);
print $page->response();
return Apache2::Const::OK;
}
XML-based page description
<?xml version="1.0" encoding="UTF-8"?>
<page
import="Import::Client"
transform="view.xsl"
xmlns:page="urn:www-page">
<manifest>
<title>My website</title>
<locale>en-gb</locale>
<page:keyword-list/>
</manifest>
<content>
<page:month-calendar/>
</content>
</page>
Parts of imported controller script
package Import::Client;
use utf8;
use XML::LibXML;
sub keywordList
{
my ($this, $page, $node, $args) = @_;
my $sth = $dbh->prepare("select keyword, uri from keywords order by keyword");
$sth->execute();
while (my ($keyword, $uri) = $sth->fetchrow_array())
{
my $item = $page->{'xml'}->createElement ('item');
$item->appendText($keyword);
$item->setAttribute('uri', $uri);
$node->appendChild($item);
}
return $node;
}
ABSTRACT
WWW::Page makes website built on XSLT technology easy to start. It provides simple mechanism to describe behaviour of pages in XML files, adds external logic and applies XSL transformations. Both XML and XSLT files are being transparently caching.
DESCRIPTION
This module provides a framework for organizing XSLT-based websites. It allows to put the process of calling user subroutines and applying XSL transformations behind the scene. Wherever possible, XML and XSL documents are cached which eliminates the need of useles reloading and re-parsing them.
EXAMPLE
Directory example
in the repository contains an example of sample website running under mod_perl and WWW::Page.
Known limitations
GET and POST parser cannot accept uploaded files and Unicode-encoded strings.
Example does allow only one editor user; only latin symbols may be in keyword list.
AUTHOR
Andrew Shitov, <andy@shitov.ru>
COPYRIGHT AND LICENCE
WWW::Page module is a free software. You may resistribute and (or) modify it under the same terms as Perl.