Open Fusion

Appendix B: Embperl Overview

ewok is built on top of Embperl (Embedded Perl), a very nice framework that allows you to embed perl within HTML and build websites out of inheritable components (as in ewok templating). If you're interested in using perl within your ewok pages or templates, you're recommended to explore the Embperl homepage at http://perl.apache.org/embperl.

To get you started, though, here's a quick primer:

  • embperl has a set of delimiters (all of which include [ and ]) for identifying perl code and embperl commands. The following are the most common:
    • [+ perl code +] - executes the perl code, putting the result into the HTML output
    • [- perl code -] - executes the perl code but produces no output
    • [! perl code !] - same as [- -], but executed only once ever - useful for initialisations, library loading etc.
    • [$ embperl command $] - perl-like control commands (if and endif, while and endwhile, foreach and endforeach) that provide loops and conditionals around mixed html / perl blocks
    • [# comment #] - an embperl comment, deleted from the output
  • by default, embperl is disabled for ewok pages for security reasons, and must be specifically enabled for the file or directory by your friendly ewok admin
  • if embperl is enabled for a page and you want a normal [ character use a doubled version i.e. use [[ for [