The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

WWW::Page - XSLT-based and XML-configured web-site engine.

SYNOPSIS

Main CGI script

    use WWW::Page;
    use encoding 'utf-8';

    my $page = new WWW::Page ({
        'xslt-root'       => "$ENV{'DOCUMENT_ROOT'}/../data/xsl",
    });

    print $page->as_string();

XML-configuration of a page

    <?xml version="1.0" encoding="UTF-8"?>
    <page
        import="Import::Client"
        transform="view.xsl"
        xmlns:page="urn:www-page">
    
        <manifest>
            <title>WWW::Page Web-Site</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 = shift;
        my $page = shift;
        my $node = shift;
        my $args = shift;
    
        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 web-site built on XSLT technology easy to start.

DESCRIPTION

This distributive contains 'example' folder with a copy of a web-site built on WWW::Page.

EXAMPLE

Example of how to use WWW::Page module for creating XSLT-based web-site.

This example is a demonstration of how to create a blog with tagging, search and month-calendar.

Enroll your http://localhost/ (or whatever) and ensure the following:

1. document root is beeing pointed to example/www; 2. allow .htaccess for example/www; 3. point script aliases to example/cgi; 4. create database 'blog' and update its credentials at example/cgi/Import/Datasource.pm.

Database scheme is in example/data/scheme.sql, sample data are in example/data/example-data.sql.

Use http://localhost/ to view the web-site, and http://localhost/adm/ to add or edit messages.

Future versions of WWW::Page will have more detailed description.

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.