views:

369

answers:

7

I've been having an agruement with a friend that Mason (Perl) is not a framework, but a templating language. I feel Mason for Perl does what JSP does for Java (as an analogy, not pure technical comparison). From what I know, JSP is not a framework and I feel neither is Mason. When I looked up wikipedia Mason (Perl), I see that the main site says it is a web application framework written in Perl while the discussion page contests it.

Any pointers on why it is/ it is not a framework?

Update based on comments from ysth: For a framework, I feel it should at least make db access easy, manage sessions, basic security that a webapp would need, templating and code reuse (or libraries that make basic tasks easy).

A: 

Depends of your definition of framework.

You can apply name framework to any library if it does more than one thing.

Dev er dev
+3  A: 

A templating system would be something like HTML::Template, that is, a module that only does templating.

I feel that Mason does more, it has somehow a routing mechanism, it provides argument handling though %ARGS, intialisations through %INIT.

It also provides interfaces to mod_perl, CGI...

Now, it does not talk to the database, as if you want a clean way to do it, you'll have to use Class::DBI, DBIx::Perlish or one of the other hundred perl modules that does object mapping, or whatever else...

mat
+3  A: 

Can't answer the question to whether HTML::Mason is or isn't a framework without looking at it but I'm always happy with the following definition....

"a framework calls your program whereas your program calls a library"

/I3az/

draegtun
+1  A: 

Looking at Embedded Perl in HTML with Mason view of its competition, I'd say it is a template language. Otherwise Catalyst and Maypole would be on the list. Also, I think I read somewhere that you can use Mason as the View portion in a Catalyst application.

I guess I can see where you can use it like a framework, but it seems to be more complete if you view it as a template language.

gpojd
+2  A: 

It is not an Model-View-Controller type of framework, it is probably closer to PHP than Ruby on Rails for example (and just as bad from what I have seen of it).

Keltia
+7  A: 

Mason is an 'M' short of being a MVC (Model-View-Controller) framework. It provides extensive rendering (View) features, which is why people think of Mason as being a templating language. However it also provides quite a few dispatch mechanisms (epsecially in the form of dhandlers), and control mechanisms (which fit naturally into autohandlers).

A few years ago I wrote an on-line tutorial (in Mason) to show off some of these features. It's optimised for full-screen display, and needs javascript enabled.

What Mason doesn't give you is a database abstraction layer, so you have to bring your own Model.

To the best of my knowledge amazon.com is written in Mason, along with many other sites.

If you enjoy working with Mason, but you'd like to have a Model, more toys, and a pony, then you may consider looking at Jifty as a web application framework.

pjf
A: 

Mason alone is not a framework it's just a template system BUT with some very cool features. It's got it's own structure and you can embed perl code very easely in it also it's got cache support. I've seen people who use Mason alone for developing a large application, but I guess it works better in an MVC framework.

Take care!

marghi