CGI::Embedder - Module for HTML embedding in your Perl programs.
#!/usr/local/bin/perl -w use CGI::Embedder; ... CGI::Embedder::ExpandFile("tmpl.htm");
# where tmpl.htm is: <h1>Hello</h1> <?for(my $i=10; $i<20; $i++) {?> Hello, world N$i! $i * $i = <?=$i*$i?><br> <?}?>
This module is used to parse e-perl templates.
use CGI::Embedder
Compile($content [,string \&filter_func(string $input)])
$content
to print
series.
You may then run eval
for resulting string to print out the template.
Template example:
Text with variable: $variable. Running: <?do_some_work(); do_another_work()?> Product is: <?=$a*$b*$c?>
If &filter_func
defined, this function is used to parse
the the HTML placed outside code tags.
Expand($templ [,$cacheId] [,$filename])
$templ
. Compiled code
is cached using $cacheId
hash-code. Parameter $filename
is used
ONLY in resulting error messages. If your need to get the output as string,
use CGI::WebOut to grab it:
use CGI::WebOut; my $str=grab { CGI::Embedder::Expand($template) };
ExpandFile($filename)
$filename
content.
Dmitry Koteroff <dk@dklab.ru>, http://www.dklab.ru