10.1 Introduction


HTML::Embperl (aka Embperl) is a Perl module that allows the execution of server-side programming code by embedding Perl code into HTML files. Embperl, written and maintained by Gerald Richter, can be found at http://perl.apache.org/embperl/.

A powerful feature of Embperl is that it is hooked into mod_perl. Most mod_perl features apply to Embperl, so if you know mod_perl, you need know only a bit more to use Embperl. As in mod_perl, the code in the page is compiled only the first time it is called (or when the file is modified), as is the case with Apache::Request programs with mod_perl.

The result of the compilation is cached so that the next time the page is requested , the Perl code does not need to be recompiled. It is the Perl code compilation that is cached, not the generated HTML code. This means that the next time the page is requested, the Perl code reexecutes (but does not recompile) to generate the HTML for that request. If the HTML file is modified, a recompile is forced, but that is a good thing because we want the changes to take effect. After the recompile, the Perl code is again cached. This makes for efficient execution. Also, as in mod_perl, the internals of Apache are available to use if we want them, so Embperl can hook into Apache's different phases (such as authentication and logging) if the application warrants it.

Embperl is basically Perl code ”and you know how we feel about Perl. You can write Perl server-side programs embedded within HTML files. Mmmm, Perl...



Open Source Development with Lamp
Open Source Development with LAMP: Using Linux, Apache, MySQL, Perl, and PHP
ISBN: 020177061X
EAN: 2147483647
Year: 2002
Pages: 136

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net