www.opensourcewebbook.com
 
     
  Page Path - Contents - Embperl  
     
 
Home
About
Foreword
Reviews
Authors
Purchase
Errata
Sourcecode
Resources
Tools
Contents
Linux
Apache
Perl
MySQL
WML
CGI
mod_perl
SSI
Embperl
Mason
PHP
     

HTML::Embperl

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 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 only a bit more to use Embperl. As in mod_perl, the code in the page 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 meas 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. Mmmmm, Perl...

Embperl Links

Embperl home page
Embperl German home page

 

     

EXAMPLES:

index.html:
index.html
index.html contents

link.html:
link.html
link.html contents

if statement:
if.html
if.html contents

while loop:
while.html
while.html contents

foreach loop:
foreach.html
foreach.html contents

posted data with %fdat:
fdat1.html
fdat1.html contents
fdat2.html contents

magic $row and $col:
rowcol.html
rowcol.html contents

HTML::Embperl Project

take1.html:
take1.html
take1.html contents
embperl_template.pl

/embperlproject/:
/embperlproject/
base.html contents
index.html contents

cool.html:
cool.html
cool.html contents

sub1:
/embperlproject/sub1/
index.html contents

sub2:
/embperlproject/sub2/
base.html contents
bottom.html contents
index.html contents

sub3:
/embperlproject/sub3/
base.html contents
index.html contents
newtitle.html
newtitle.html contents

product_database.sql:
product_database.sql

productfilter:
/productfilter/
base.html contents
index.html contents
/productfilter/productdetail/
index.html contents