comparison of html/perl methodologies
Hello, I have written a fairly good sized CGI using CGI.pm that I ran first as a standalone, then under modperl. Now, I'm interested in looking at web authoring from the reverse perspective - embedding Perl in html. A quick look tells me that there are a number of possibilities out there -- Apache ASP Mason Embperl HTML::Template There are probably some others as well... After having looked at their respective web sites, I seem to be having trouble understanding how these are different from one another and their relative strengths and weaknesses. Would anyone care to take a stab at making some kind of summary of distinctive qualities, goals, etc. Thanks, Paul Phillips ___ Paul Phillips Director of Orchestral Activities, Meadows School of the Arts Southern Methodist University "You must sing every note you play, sing even through the rests!" Arturo Toscanini
Re: comparison of html/perl methodologies
On Sun, 31 Dec 2000, Paul Phillips wrote: Now, I'm interested in looking at web authoring from the reverse perspective - embedding Perl in html. A quick look tells me that there are a number of possibilities out there -- Apache ASP Mason Embperl HTML::Template There are probably some others as well... Our numbers are legion. After having looked at their respective web sites, I seem to be having trouble understanding how these are different from one another and their relative strengths and weaknesses. Would anyone care to take a stab at making some kind of summary of distinctive qualities, goals, etc. I'm writing just such a document, but it's not finished. For now, look in the mailing list archives for previous discussions on this topic. A couple of words of advice: If this is a very simple site that will be worked on by one person and will not change it's look very much, it doesn't matter which one you choose. Just grab whichever one looks like the most fun or the easiest to get started with. If this is a bigger project that involves multiple coders, HTML-only people, or will change it's look often, your work will be easier to maintain if you keep a good separation between the "application" code and the "presentation" code. This is in contrast to the PHP style of putting all your code in-line in the HTML. You can do this kind of separation with just about any tool. Mason, Embperl, and Apache::ASP can do this by putting your code in modules which you call at the beginning of the template and then use the results of. (Well, they each have their own special ways of supporting this as well, but it amounts about the same thing.) Your templating constructs (loops, conditionals) will be written in Perl in-lined in HTML. HTML::Template and Template Toolkit generally expect you to write a CGI or modperl handler that will do some work and then run the result through a template. The templating constructs are done with a mini templating language when using these modules. The basic question you have to answer is whether or not the people who have to edit the "look and feel" part of your templates will be happier and more productive using in-line Perl or one of these templating languages. If you're building a larger project and want some help figuring out how to organize it, take a look at Apache::PageKit, which provides a skeleton for developing applications using HTML::Template. I use a homegrown system which is very similar in spirit but works with Template Toolkit, which I prefer. Hope that gets you started. There's tons more in the archives. - Perrin
Re: comparison of html/perl methodologies
Hello, PPNow, I'm interested in looking at web authoring from the reverse PPperspective - embedding Perl in html. PP PPA quick look tells me that there are a number of possibilities out there -- PPApache ASP PPMason PPEmbperl PPHTML::Template HTML::Template is not an embedded Perl solution per se, but rather a templating system. It's a rather fine line but the crux of it is that rather than embedding Perl code in non-Perl text per se, it's Perl that interprets non-Perl text in a special way. In contrast Apache::ASP, Mason, and Embperl are all full-fledged embedded Perl implementations. I would say that the embedded Perl implementations are better for data-driven pages (e.g. there is more non-Perl text (HTML or XML or whatever) than Perl code), whereas the template systems (other ones include homegrown variable substitution and Text::Template) are better for pages where there is more Perl code than output. An example of the former (data-driven) might be a website that displays and lets you manage a stock portfolio--most of it stays the same except for some dynamic data parts. An example of the latter could be an HTTP data server that returns XML. Generally, it's easier to transition from a pure CGI based system to a templatized system rather than an embedded Perl system, because a template system basically centralizes all your print() statements into a template fill-in call. However, I think the embedded Perl syntax gives a more powerful separation of code and presentation. One advantage of Apache::ASP is that its syntax (% code %, %= expr %, etc.) and semantics are very well known, so this is great for working with coders who may have had some exposure to ASP in the past. Humbly, Andrew -- Andrew Ho http://www.tellme.com/ [EMAIL PROTECTED] Engineer [EMAIL PROTECTED] Voice 650-930-9062 Tellme Networks, Inc. 1-800-555-TELLFax 650-930-9101 --