Web Developer's Virtual Library: Encyclopedia of Web Design Tutorials, Articles and Discussions


WDVL Newsletter

Active Server Pages
JSP/Java Servlets
Microsoft SQL Server
Daily Backup
Dedicated Servers
Streaming Audio/Video
24-hour Support    

jobs.webdeveloper.com

Hiermenus


e-commerce
Partner With Us















Developer Channel
FlashKit.com
JavaScript.com
JavaScriptSource
Developer Jobs
ScriptSearch
StreamingMediaWorld
Web Developer's Journal
Web Developer's Virtual Library
WebDeveloper.com
Webreference
Web Hosts
XMLfiles.com

internet.com
IT
Developer
Internet News
Small Business
Personal Technology

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers


Personalization Methods Part 3, Embperl

November 20, 2000

This months installment of The Perl You Need to Know series concludes the Personalization Methods Trilogy with a look at how Embperl eases the burden of tying together the disparate parts of the personalization system.

Every good, or not so good, work of science fiction is a trilogy -- it's an immutable law of nature. Our series on web personalization, back-ends, and Perl is no fiction, and only arguable scientific, but a trilogy indeed. The past two installments considered first the principles behind database-backed and cookie-fronted personalization architectures, using databases as "long term" memory and cookies as "short term" memory. Most recently, in PYNTK 18 we got our hands dirty with some Perl code, authenticating a user's login against a database and setting a temporary authentication cookie. Our trilogy does not end with any shocking secrets (no, I am not your father), but riveting nonetheless is the tale of Embperl, a Perl module used to embed Perl code inside a server-parsed HTML document. We'll see how Embperl eases the burden of tying together the disparate parts of our personalization system.

Meet the Embperl

The principle of server-parsed HTML is straightforward: rather than simply hand over an HTML document to the client, the server first interprets the file and executes any code therein, replacing that code with its results and returning the final document to the client. Just what "code" the server parses and executes depends on the server-parsed language being used, and there are many: PHP and ASP being the most popular. But why learn (or invent) a new language when we're already in love with one: Perl! The authors of Embperl took this opportunity to create support for embedding Perl code inside server-parsed HTML pages.

The possibilites of embedded Perl are almost infinite, and gives a real kick in the pants to HTML coding. To be fair, Embperl is only one embedded Perl solution -- there's also HTML::Mason and Apache::ASP. Each vary in their approaches and are more or less suited to particular situations -- in this case, obviously, we're using Embperl, more accurately referred to as HTML::Embperl. Embperl is ideal for a mod_perl enabled environment, but you can also use Embperl in more traditional CGI processes.

Embperl's web site contains detailed installation instructions and test examples for different systems, so in the interest of getting to the point, we direct you there and assume that your web server is now interpreting HTML files with Embperl. One footnote: the Embperl documentation illustrates a special filename extension -- .epl -- for files to be Embperl-processed. The rationale is probably to avoid processing costs of "regular" HTML files. In our example we're coding for a site that has Embperl processing enabled site-wide, and for that reason Embperl is configured in our Apache server to process all .html files, rather than creating a special alternative filename extension.

Contents:

Meet the Embperl
A Short Course in Embperl
Execute, @param, and %fdat
Cookies from the Oven
By Invitation Only: Requiring Login
User Sensitivity 101
Epilogue

The Perl You Need to Know
A Short Course in Embperl


Up to => Home / Authoring / Languages / Perl / PerlfortheWeb




Jupiter Online Media: internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and Jupiter Online Media

Jupitermedia Corporate Info


Legal Notices, Licensing, & Permissions, Privacy Policy.

Web Hosting | Newsletters | Tech Jobs | Shopping | E-mail Offers