Skip to main content
Embedding Perl with HTML::EP

At various times in my short programming carreer, I have programmed in ASP, JSP, PHP and Perl. The first 3 of those languages had nice features which would allow dropping language code into HTML documents. So if I needed some small pieces of dynamic information such as a date or a name to go into an otherwise largely static HTML document I could encapsulate the code in certain tags, submit it to the webserver and have it return the static + dynamic information. There was minimal performance effect and as a programmer I had freedom to choose where to place the code for extracting the dynamic output.

Until now however, I never did this in Perl/CGI. Whenever I needed dynamic information in Perl I would have to write a script for it. This was a huge waste for such HTML output-pages which were for the most part static. I had to write a script and print all of the static content in one or more print statements.

Apparently Perl language add-ons/modules have been available which allow embedding Perl into HTML pages for quite some time. I discovered one such today - the HTML::EP module. This allows special tags for letting the server know how they should be handled (ex. pass on to Apache mod-perl).

More documentation about HTML::EP at http://cpan.uwinnipeg.ca/htdocs/HTML-EP/

A nice feature HTML::EP has is the concept of multiple tag types which cater to special functions such as for example sending email.

<ep-mail subject="Howdy!" from="joe@ispsoft.de" to="joe@ispsoft.de">
Hello, Bill, old chap. How are you?

Yours sincerely,
John
</ep-mail>

I think this construction is superior to the other languages such as JSP, PHP or ASP as it allows for purpose specific calls, rather than having a single call for all purposes.

Comments

This is a superb post Embedding Perl with HTML::EP. I benefit from the knowledge lot. I will bookmark this page. show gratitude’s for sharing this information.