[prev in list] [next in list] [prev in thread] [next in thread] 

List:       mason
Subject:    [Mason] Embperl vs. Mason
From:       Chris Alexander chris () forum ! swarthmore ! edu
Date:       1999-02-25 14:35:05
[Download RAW message or body]

Hello mod_perlers,

I've been evaluating HTML::Embperl and HTML::Mason, and I want to present 
my findings here with the hope that you can offer comments or advice. 
Such comments might also be helpful to others who are making similar 
choices. Here are my general impressions:

Both Mason and Embperl run as perl modules under mod_perl, and both are 
intended to allow the use of perl code on web pages. Embperl has an
"Execute" function which is similar to Mason's mc_comp function. You
can execute a template and pass in arguments.  Embperl compiles and caches
perl code like Mason does. Both programs put posted and query string data 
into a hash which is available on pages.

Embperl has some nice HTML-specific features: it will automatically fill
in form fields with default values from posted form data, as well setting
defaults in select lists, checkboxes, and radio button groups. Also you
can tell it to automatically HTML-escape its output. Embperl also has
close integration with Apache::Session, which I haven't tried, but it
seems pretty slick; you can store per-page or per-module data in %mdat,
and per-user data in %udat, and the correct data will automatically be
available when the given user returns or the given page is loaded.

Mason doesn't have any of the above features, but it does have some nice
features Embperl doesn't have. Mason has <%perl_args> and <%perl_init>
blocks which allow you to hide perl code at the bottom of the page and leave
the HTML at the top. Mason can preload components at startup time, so their
memory is shared by all the children. Mason has a previewer which allows you
to see a tree of the components used on a page. The previewer also allows
you to browse your site with a fake user agent and/or date. Mason allows you
to use perl to debug and profile components. With Mason, you can create a
"dhandler" component which allows you to easily combine real directories and
files on your website with fake, Mason-generated pages. I especially like
this feature.

Embperl, because of its HTML-specific features, requires that you use 
valid HTML on your page. Otherwise you'll get cryptic errors like "Stack 
underflow". Embperl allows either buffered or streaming output, but I 
found that running in streaming mode causes strange problems (some 
Executes didn't output, for example). Mason seems to run fine in either 
mode.

Debugging Mason components can be a pain because the error messages, and 
the line numbers for the errors, refer to Mason's internal version of 
your component, not your actual component file. Mason doesn't allow you to
define subroutines within a component (Embperl does). Mason daemons also seem 
to use lots of memory: ours start at 18 megs and grow from there. By 
comparison, our Embperl daemons, with the same perl modules loaded, are 
more like 14-16 megs, and they barely grow in size with use.

I haven't used either package in a production environment yet, and I'm 
interested to hear from those of you who have. Which features or 
annoyances have I missed here? Which package do you prefer, and why?

Thanks,
Chris
======================================================================
To unsubscribe: echo unsubscribe | mail mason-request@netizen.com.au
Charter/FAQ/Archive: http://www.netizen.com.au/resources/lists/mason/

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic