To Embed ... or Not to Embed
July 17, 2000
Our last embedded Perl example, where we build a result table from a
database query, illustrates both the pros and cons of working with embedded
Perl. The primary advantage of embedding Perl is seen as we can elegantly
construct a table on-the-fly, allowing Perl to "pull the strings"
of the HTML. The primary disadvantage of embedded Perl is the discontinuous
nature of the code ... creating an ASP segment simply to insert a closing
curly brace shows how the Perl code is fragmented around the page.
Some developers find it difficult to work with scripts that are broken up in
this way, and debugging is certainly a greater challenge since the Perl is
"polluted" with tags. Some organizations disallow the use of
embedded programming because it confounds their internal division of labor,
where HTML authors work on separate files from Perl programmers.
Having said all that, embedded scripting is gaining in popularity, so many
developers are not put off by these disadvantages. Embedding is certainly a
convenient way to rapidly prototype pages and rapidly integrate the power of
scripting into the functional aesthetics of HTML templates.
Additional Resources
Apache::ASP
Mason
Embperl
Microsoft
ASP
PHP
Apache::ASP -- Ebony and Ivory Living Together in Harmony
The Perl You Need to Know
|