Apache2::TomKit - Perl Module used to Transform Content
<Files *\.xml> PerlFixupHandler Apache2::TomKit PerlSetVar AxAddProcessorDef "text/xsl=>base.xsl" PerlSetVar AxAddProcessorDef "text/xsl=>html.xsl" PerlSetVar AxAddProcessorMap "text/xsl=>Apache2::TomKit::Processor::LibXSLT" PerlSetVar AxContentProvider My::Content::Provider </Files>
TomKit is a perl handler which is working similar as the famous AxKit for mod_perl 1.x. It is designed as an PerlFixupHandler which inserts an OutputFilter if needed to transform XML-Content.
Although designed primarily to transform XML-Content it can be used to create any arbitary output like e.g. PNG, ... . The big advantage is the easy to configure caching behaviour.
TomKit is configured by setting configuration variables using PerlSetVar like shown in the synopsis.
Configure the processor definition file used by the processor. The format of the looks like the following:
You can use add more than one processor. They are restored in a processor chain and run next to each other.
You don't necessarily have to set the processor definition in the configuration. TomKit has the possibility to read the processor definitions directly from the processed file. This looks like the following:
<?xml version="1.0" ?> <?xml-stylesheet href="base.xsl" type="text/xsl"?> <?xml-stylesheet href="html.xsl" type="text/xsl"?> <!-- THE START OF THE XML-FILE --> <!-- .... --> <!-- THE END OF THE XML-FILE -->
Please note all relative paths are prefixed with the document-root if AxNoCompilance is set to 0. If AxNoCompilance is set to 1 all paths are relative to the root path!
Configure the processor used to transform the input-source. The format looks like the following:
Configure the content provider which provides the content to the transformer chain as its name indicates. If you don't configure a AxContentProvider there are 2 possibilities:
the default response handler of apache is used. This means caching is avaiable out of the box and done automatically by TomKit for you
a content handler is another apache-module e.g. PerlResponseHandler. Although very cool it has the disadvantage that caching is not available out-of-the-box. To use caching possibilities TomKit provides to you your ResponseHandler has 2 possibilities:
setting the AxMTime to the value the content has modified last time
setting AxMTime in the HTTP-Header
This turns off AxKit-Compilance which is not given out-of-the box.
Chdir to document-root is possible automagically because of threading issues. Please note that running with no AxKit-Compilance may be faster and can be achieved by evaluating the special parameter "_TOMKIT_DocumentRoot" which is passed to XSLT-Processors.
Setting this flag to true the cgi-parameters passed are also taken into consideration when the cache-key is generated.
You can configure the path where TomKit restores the cached results. If you don't set any the default location is created using 'File::Spec->tmpdir() . "/axkit"'
You set the debug-level verbosity of TomKit to debug your XSLTs the default level is 0 where only errors are logged
Tom Schindl, <firstname.lastname@example.org>
The latest version of the application can be found on my companies publicsvn-Server: http://publicsvn.bestsolution.at/repos
Bugtracking is done using mantisbt which can be found at here: http://phpot.bestsolution.at/mantis/main_page.php
Copyright (C) 2005 by Tom Schindl and BestSolution Systemhaus GmbH
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.6 or, at your option, any later version of Perl 5 you may have available.