|eval(emitHTML($filePath),$flags);||processes $filePath and emits the resulting HTML on STDOUT.|
|my $content = eval(genHTML($filePath),$flags);||processes $filePath and returns the resulting HTML.|
As shown above, calls to either routine must be wrapped in an eval (which allows locally defined variables to be referenced in the HTML template).
my $content = eval(genHTML("path/to/page.ht"),$flags);
FlagsThe second argument is an integer that sets debugging flags; flags are enabled by adding the following together:
|1||save generated file to path/to/debug/page.ht.out|
|2||save debugging information to path/to/debug/page.ht.dbg|
|4||embed debugging information in the generated HTML|
|8||save internal state after completion|
Flags 2, 4, and 8 are primarily used to debug emit.pl (rather than the template).
TemplateThe HTML template file may contain Perl variable references. It may also contain preprocessing directives to cause lines to be conditionally included (or not). Preprocessing directives begin in column one and start with a hash "#".
The preprocessing directives are:
- #if condition
- #elsif condition
- #include path/to/file
The argument to #include is the path to another HTML template file that is to be included into the output.
Note: Lines with only a hash or with a hash that is followed by either a space or another hash are comments.
Send me reports of any errors or suggestions you have about my Perl scripts.
The code described on this page is Copyright 2003, 2007 Tony Lewis <email@example.com>.
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
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 GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.