Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is Mason a framework?

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).

like image 639
Arvind Avatar asked Dec 08 '08 10:12

Arvind


2 Answers

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.

like image 147
pjf Avatar answered Oct 08 '22 04:10

pjf


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...

like image 26
mat Avatar answered Oct 08 '22 02:10

mat