Embperl - building dynamic websites with Perl


What is Embperl?
[ Content ] [ Next: How to Embed Perl Code in HTML Documents >> ]

Embperl has started as a Perl module for simply embedding Perl into HTML and has grown to a full featured system to build dynamic content (not only) under mod_perl. The version 1.x focuses on HTML documents, also it could be used for any sort of ascii files, and brings a lot of features especially useful in a web-environment. These features include handling of form data and dynamic HTML tables/lists, session management and context sensitive escaping and unescaping. Moreover you can break up your documents in small reusable components/objects and build an object-oriented website out of such objects, by using inheritance and specifically overriding parts of the page. Also Embperl can cope with pages that are screwed up by high-level HTML editors, so your designer can still use their favorite tool.

Embperl 2.0, which is a complete rewrite of the Embperl core, is not only much faster then 1.x, but adds new possibilities. You can extend or define your own syntax, thus giving the chance to trigger actions on certain tags or inventing your own tags (creating a taglib). It is much more modularized, so specific steps could be replaced by a custom processor and more than one processor can act on a document before it goes to the browser (just like a Unix pipe). To enhance performance 2.0 introduces caching of the output or intermediate steps.

Due to this modularization, it is now possible to replace the Embperl parser by an XML parser and to do XML processing, for example by plugging in an XSLT processer in the processing pipeline. Embperl 2.0 can utilize libxml2 and libxslt for XML and XSLT processing.

All versions of Embperl can be used offline (as a normal CGI script or as a module from other Perl code), but its real power comes when running under mod_perl and Apache. It's directly integrated with Apache and mod_perl to achieve the best performance by directly using Apache functions and precompiling your code to avoid a recompile on every request.



How does it compare to other templating solutions ?top

Embperl is not the only processor for embedded Perl code. I guess every second webprogrammer builds his own templating engine. Most of them are very similar and easy, but do a good job in a certain environment. Often after a while these programmer discover, they need more features and that other people in the same situation has already build a soltuion for their problems. At the moment there are five widely used Perl modules for generating dynamic web content (Embperl, Apache::ASP, HTML::Mason, Template::Toolkit and AxKit). All of these have their special strength. So why to use Embperl? We believe that Embperl, especialy the version 2.0, covers all of the aspects of these modules and integrates them in one module with addtionaly benefits that are unique to Embperl. Additionally Embperl is the fastest of these solutions, because it's engine is totaly written in C and is optimized for delivering dynamic content online.

Another competitor for Embperl is PHP. PHP is developing a strong user base, because it is rumored to be easy to learn, and was designed specifically for HTML. Also PHP is probably one of the strongest open source alternatives to using Perl in your HTML, it's target is very webcentric and you may discover at a certain point that is has its limitations when you try to realize great projects. Also it's not true, like some anecdotal stories on the Web might want to make you believe, that PHP is faster than Perl. Perl, and therefore Embperl also, scales and performs very well for high end solution.



Focus of this documenttop

This tries to be an introduction to the basics of Embperl. perldoc IntroEmbperlObject gives you an tutorial about how to build an object-oriented website.


[ Content ] [ Next: How to Embed Perl Code in HTML Documents >> ]


© 1997-2023 Gerald Richter / actevy