http://qs321.pair.com?node_id=180532

the_Don has asked for the wisdom of the Perl Monks concerning the following question: (object-oriented programming)

I have read previous posts regarding the use of MASON and they all categorize MASON as primarily a templating tool. Some posts refer to other embedded perl programs (other than MASON) and specifically mention what is possible. There is no specific mention of MASON's perl capabilities.I have read documentation on the MASON site, and what I have read only says that perl my be embedded.

Does MASON inlcude ALL the functionality of the current version of perl, including object-oriented schemas?

If MASON does claim that all functionality is possible, is it true in practice? If you have had any successes or failures regarding MASON, please elaborate.

(It is possible that the current version of a web site will be completely re-designed. The primary objective is to interface with a DB as well as allow users to designate their own interface to the DB. Thus far, MASON is our #1 contender to be the replacement.)

I thank you in advance for any and all constructive comments and appreciate the resources that are readily available here. If I have placed this in an incorrect category, I apologize.

Originally posted as a Categorized Question.

Replies are listed 'Best First'.
Re: MASON - more than templates ?
by cephas (Pilgrim) on Jul 09, 2002 at 22:18 UTC
    Mason has the flexibitly to be much more than a templating system, it can function more as a development medium, somewhat similar to PHP (I think, I know very little about PHP in reality).

    Mason works well for those sticky places where form and function can't quite be separated the way we would all like in an ideal world. You can suddenly stash those code/html chunks away in components (which have inheritence), as well as set up some default behaviours for all of your components.

    As for supporting Perl functionality, I've built large scale database applications using Mason, that included things such as anonymous subroutines in config files, debug modules that walked the symbol table and replaced subroutines matching a pattern with stubs, and other perlish type things. I'd have to say I haven't encountered a situation yet that we couldn't get through.

    All those things being said, if you just want to get your web folks access to some variables, you'd probably be better off sticking to one of the other great templating systems around, because Mason really is a lot more (think hitting flies with a sledge hammer)

    cephas
Re: MASON - more than templates ?
by archangelq (Novice) on Feb 04, 2004 at 20:46 UTC
    Mason is a very powerful system, it all depends on your needs. If your target is to have a perlish replacement for PHP, then I'd fully suggest it, having had to work in both a great deal.

    My preference is strongly on the perl side, so take this with the grain of salt it's worth, but I find mason to be massively more flexable than PHP.

    As for a general purpous templating system, both cephas and merlyn have good points. It comes down to that, you can do nearly anything in Mason that you can do in perl, with the display code nicely seperated, but still closely associated. This is good, but you have to be careful of adding in to lengthy of code into any mason component. Nutshell: The more perl there is, the harder it is for an html design person to come in and edit anything. You have to decide for yourself if that's what you want.

Re: MASON - more than templates ?
by merlyn (Sage) on Jul 09, 2002 at 18:02 UTC
    I'd strongly suggest looking at Template Toolkit instead, as it is much more general purpose, and has a mini-language which can be taught to non-Perl-programmers much easier. And yet, you can embed Perl directly if you wish.
Re: MASON - more than templates ?
by blogical (Pilgrim) on Mar 24, 2006 at 16:30 UTC
    Two great places for more information on Mason:

    Embedding Perl in HTML with Mason by Dave Rolsky & Ken Williams (full text online too!)

    Mason HQ for all your fully up-to-date mason info and discussion.

    From the preface to the mason book:
    "Mason is a tool for embedding the Perl programming language into text, in order to create text dynamically, most often in HTML. But Mason does not simply stop at HTML. It can just as easily create XML, WML, POD, configuration files, or the complete works of Shakespeare."

Re: MASON - more than templates ?
by Anonymous Monk on Apr 02, 2004 at 13:27 UTC

    Re: MASON - more than templates ?

    Originally posted as a Categorized Answer.