TemplateTest.pl - Test Penguin Greetings Embperl templates
TemplateTest.pl [-b] [-c .../pgreet.conf] [-d] [-p .../cards.conf] template.tpl.html var1=value1 var2=value2 ...
TemplateTest.pl
is a utility for development of
Embperl based templates for the Penguin Greetings web-based
greeting cards system. It can be used to test a template page
for correct Embperl syntax and for correct appearance given
particular parameters. It can launch your favorite browser so
that the page under development can be viewed under realistic
conditions. It can also be used to dump the state of transfer
variables to a given template page.
TemplateTest.pl
requires the standard Penguin
Greeting environment in order to function. The only module it
uses that is not included in Perl 5.8.0 is
Embperl
. It is convenient to edit the Perl source
file to change the default paths to your pgreet.conf
and cards.conf file so that it isn't necessary to
specify this each time on the command line. To take advantage
of the view page in browser option, you must edit the path to
your browser and set the file prefix. See the top of the
TemplateTest.pl
file for more details. The path to
store temporary files is /tmp/pgreet/TemplateTest.
This can also be changed to suit local environments.
TemplateTest.pl
performs two tasks. When used
with the -d
option it can be used to display all
the state variables passed to a template page. Otherwise it can
be used to process a given template with Embperl and view the
resulting pure HTML. In order to allow the developer to set the
value of state variables that are unique to their pages,
variable, value pairs can be passed to the program separated by
an equals sign =
. So for example, to process the
file MyTemplate.tpl.html
with the variable
penguin
equal to 5
and the variable
camel
equal to 2_hump
the command
would be:
TemplateTest.pl MyTemplate.tpl.html penguin=5 camel=2_hump
Variables or values should be quotes as necessary to avoid
being misinterpreted by your command shell. Normally,
TemplateTest.pl
displays the dumped variables or
the resulting HTML to standard out. If you use the
-b
option, it will instead save the rendered HTML
to a temporary file and launch a browser so that you may view
the resulting page. There are 4 command line options explained
below:
-b
= Render the template into an HTML page,
save as a temporary file, and launch a browser to view the
resulting page. In order for this to work you must set the
variables: $browser
, $prefix
, and
$tmp_path
to appropriate values for your
system.
-c path_to/cards.conf
= Use the specified file
instead of the default file for the Penguin Greetings
cards.conf card configuration file.
-d
= Do not render any template page, just dump
what the state variables for this arrangement would be. The -d
option will ignore any template filename and process only
command line arguments with embedded equals signs as additional
state variables.
-p path_to/pgreet.conf
= Use the specified file
instead of the default file for the Penguin Greetings
pgreet.conf general configuration file.
Copyright (c) 2003 Edouard Lagache
This software is released under the GNU General Public License, Version 2. For more information, see the COPYING file included with this software or visit: http://www.gnu.org/copyleft/gpl.html
There is no mechanism to clean up the temp files created in
the -b
option. There is simply no reliably way of
knowing when a user will be finished with a given temporary
file. Perhaps pgreetd.pl
will eventually be
assigned the task of garbage collection.
When using the -d
option, no template file
should be specified. This is because there is no rendering
needed when dumping the state variables. While this is a user
interface inconsistency, it seemed more prudent to respect the
programmers need for laziness than consistency! :-)
Edouard Lagache <pgreetdev@canebas.org>
0.8.3