Mason 1.0 Released
Sowbug writes: "Perl programmers rejoice! Mason 1.0 was released today,
though prerelease versions have been in operation for years at websites like TechWeb,
Salon.com, and AvantGo.
Congratulations, Jonathan Swartz
(principal author of Mason)!" I don't know much about Mason, but it seems like another cool addition to the Cold Fusion/PHP world of embeddable code in Web pages.
I have been using Mason and related packages for a long time. I agree strongly with the people who say that mixing code and markup is a bad idea. I would go even further from my own experience, and say that mixing execution and display in any way is a bad idea.
On receiving a web request, the first thing to do is process the input, perform any operations, and then set up necessary information for doing a page display, using a tool such as Mason, with the least possible amount of code. My Mason pages rarely contain more than a <% $object->get('foo') %>.
In this way one has the versatility to redirect internally if an operation fails, and one doesn't have to cope with a page crashing halfway through display.
Mason is an excellent tool for controlling a structured web site. Mixing markup and code, execution and display is a separate, general topic, and should be considered apart from any specific tool.
Mason looks okay but its still developing script within the HTML, when working with designers who don't know perl this becomes a problem. I've been using a mod called HTML::Template for some time now and I highly recommend it to anyone building web pages with Perl. HTML template allows a set of specialized HTML tags in that actual HTML documents that a separate script uses to insert data. It has varables and loops and if/else structures.
HTML::Template can also do caching of HTML pages when used with mod perl, plus the tags are ignored by commonly used HTML editors such as Dreamweaver. All in all I think its a much better solution.
"One World, one Web, one Program" - Microsoft promotional ad
The Anti-Blog
Mason is pretty nice, I checked it out when it was just getting started. They've done a lot since then.
The high-level features are outlined on their site. Among them are: caching of HTML and data, use of the Perl debugger, and staging vs. production execution modes.
The CPAN repository is chock full of mind-bogglingly useful code, so it's nice to see more tools coming of age that allow you to take advantage of all of that through the Web. mod_perl is very nice, but for some tasks, it's just too cumbersome to work at that level. Mason nicely abstracts that away.