RapidApp::Web1RenderContext
my $cx= RapidApp::Web1RenderContext->new(); $cx->render($data); $cx->write("<div class='copyright'>Copyright (c) 2042 Our Company</div>"); my $html= '<html><head>'; for my $jsFile (@{$cx->getJsIncludeList) { $html .= '<script type="text/javascript" src="' . $jsFile . '"></script>'; } for my $cssFile (@{$cx->getCssIncludeList) { $html .= '<link rel="stylesheet" type="text/css" href="' . $cssFile . '" />'; } $html .= $cx->getHeaderLiteral . '</head><body>'; $html .= $cx->getBody; $html .= '</body></html>'; # to re-use the render context, you need to clear it $cx->clear();
This module facilitates writing html fragments in short bursts and later joining them while also building up a list of javascript and css files which are required.
Note that none of these functions *return* html, they collect it within the context, to be joined later.
When you are done, you can build a proper HTML page from it.
This module also has a renderer, which can be set to any renderer of your choice.
There are also a number of handy utility methods, like "data2html".
To install RapidApp, copy and paste the appropriate command in to your terminal.
cpanm
cpanm RapidApp
CPAN shell
perl -MCPAN -e shell install RapidApp
For more information on module installation, please visit the detailed CPAN module installation guide.