NAME
Apache::PageKit - MVCC web framework using mod_perl, XML and HTML::Template
SYNOPSIS
In httpd.conf
SetHandler perl-script
PerlSetVar PKIT_ROOT /path/to/pagekit/files
PerlSetVar PKIT_SERVER staging
PerlHandler +Apache::PageKit
<Perl>
Apache::PageKit->startup('/path/to/pagekit/files', 'staging');
</Perl>
In MyPageKit/Common.pm
package MyPageKit::Common;
use base 'Apache::PageKit::Model';
sub pkit_dbi_connect {
return DBI->connect("DBI:mysql:db","user","passwd");
}
sub pkit_session_setup {
my $model = shift;
my $dbh = $model->dbh;
return {
session_lock_class => 'MySQL',
session_store_class => 'MySQL',
session_args => {
Handle => $dbh,
LockHandle => $dbh,
},
};
}
sub pkit_auth_credential {
my ($model) = @_;
# in this example, login and passwd are the names of the credential fields
my $login = $model->input('login');
my $passwd = $model->input('passwd');
# create a session key
# your code here.........
return $ses_key;
}
sub pkit_auth_session_key {
my ($model, $ses_key) = @_;
# check whether $ses_key is valid, if so return user id in $user_id
# your code here.........
return $ok ? $user_id : undef;
}
DESCRIPTION
PageKit is an mod_perl based application framework that uses HTML::Template and XML to separate code, design, and content. Includes session management, authentication, form validation, co-branding, and a content management system.
Its goal is to solve all the common problems of web programming, and to make the creation and maintenance of dynamic web sites fast, easy and enjoyable.
You have to write a module named MyPageKit::Common that inherits from Apache::PageKit::Model and provides methods common across the site. For example, if you wish to support authentication, it must include the two methods pkit_auth_credential
and pkit_auth_session_key
.
For more information, visit http://www.pagekit.org/
Most of the docs have been moved out of POD to DocBook. The sources can be found in the docsrc directory of the distribution, and the HTML output can be found at http://www.pagekit.org/guide
METHODS
The following method is available to the user as Apache::PageKit API.
This function should be called at server startup from your httpd.conf file:
If you use PageKit >= 1.09 and mod_perl < 1.26, the follow the instructions for PageKit < 1.09.
PerlSetVar PKIT_ROOT /path/to/pagekit/files
PerlSetVar PKIT_SERVER staging
PerlHandler +Apache::PageKit
<Perl>
Apache::PageKit->startup;
</Perl>
PageKit < 1.09 should be started this way:
PerlSetVar PKIT_ROOT /path/to/pagekit/files
PerlSetVar PKIT_SERVER staging
PerlHandler +Apache::PageKit
<Perl>
Apache::PageKit->startup("/path/to/pagekit/files","staging");
</Perl>
Where the first argument is the root directory of the PageKit application. The second (optional) argument is the server id. It loads /path/to/pagekit/files/Model into the perl search path so that PageKit can make calls into MyPageKit::Common and other Model classes. It also loads the Config and Content XML files and pre-parses the View template files.
FREQUENTLY ASKED QUESTIONS
See http://www.pagekit.org/faq.html Apache::PageKit::FAQ
SEE ALSO
Apache::Request, HTML::FillInForm, HTML::Template, Data::FormValidator
VERSION
This document describes Apache::PageKit module version 1.12
NOTES
Requires mod_perl, Apache::SessionX, Compress::Zlib, Data::FormValidator, HTML::Clean, HTML::FillInForm and HTML::Template, Text::Iconv and XML::LibXML
I wrote these modules because I needed an application framework that was based on mod_perl and seperated HTML from Perl. HTML::Embperl, Apache::ASP and HTML::Mason are frameworks that work with mod_perl, but embed Perl code in HTML. The development was inspired in part by Webmacro, which is an open-source Java servlet framework that seperates Code from HTML.
The goal is of these modules is to develop a framework that provides most of the functionality that is common across dynamic web sites, including session management, authorization, form validation, component design, error handling, and content management.
BUGS
Please submit any bug reports, comments, or suggestions to the Apache::PageKit mailing list at http://lists.sourceforge.net/mailman/listinfo/pagekit-users
TODO
Support Template-Toolkit templates as well as HTML::Template templates.
Support for multiple transformations with stylesheets, and for filters.
Add more tests to the test suite.
AUTHORS
T.J. Mather (tjmather@tjmather.com)
Boris Zentner (bzm@2bz.de) has contributed numerous patches and is currently maintaining the package.
CREDITS
Fixes, Bug Reports, Docs have been generously provided by:
Ben Ausden
Stu Pae
Yann Kerhervé
Chris Burbridge
Leonardo de Carvalho
Rob Falcon
Sheffield Nolan
David Raimbault
Rob Starkey
Anton Berezin
Chris Hamilton
David Christian
Anton Permyakov
Glenn Morgan
Gabriel Burca
John Robinson
Paul G. Weiss
Russell D. Weiss
Paul Flinders
Bill Karwin
Daniel Gardner
Andy Massey
Michael Cook
Michael Pheasant
John Moose
Sheldon Hearn
Vladimir Sekissov
Tomasz Konefal
Michael Wojcikiewicz
Vladimir Bogdanov
Eugene Rachinsky
Erik Günther
Bruno Czekay
Tony Martin
Also, thanks to Dan Von Kohorn for helping shape the initial architecture and for the invaluable support and advice.
COPYRIGHT
Copyright (c) 2000, 2001, 2002, 2003, 2004 AnIdea Corporation. All rights Reserved. PageKit is a trademark of AnIdea Corporation.
Parts of code Copyright (c) 2000, 2001, 2002 AxKit.com Ltd.
LICENSE
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Ricoh Source Code Public License for more details.
You can redistribute this module and/or modify it only under the terms of the Ricoh Source Code Public License.
You should have received a copy of the Ricoh Source Code Public License along with this program; if not, obtain one at http://www.pagekit.org/license.html
1 POD Error
The following errors were encountered while parsing the POD:
- Around line 1514:
Non-ASCII character seen before =encoding in 'Kerhervé'. Assuming CP1252