Arvind
Arvind

Reputation: 387

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

Upvotes: 15

Views: 4679

Answers (9)

draegtun
draegtun

Reputation: 22560

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"

Upvotes: 4

EmilPer
EmilPer

Reputation: 11

HTML::Mason is what frameworks want to become when they get older. With HTML::Mason you get:

  • a dispatcher
  • templating
  • caching
  • logging
  • extremely flexible modularization

It was designed for high performance multi-tiered web applications, not for pleasing the fans of design patterns borrowed from desktop programming (such as MVC was).

Upvotes: 1

richpara
richpara

Reputation: 11

The following definition of a framework is taken from the Gamma book on Design Patterns. "A framework is a set of cooperating classes that make up a reusable design for a specific class of software." Mason, by that definition, is a framework. An MVC framework is only one type of framework.

Upvotes: 1

marghi
marghi

Reputation: 243

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!

Upvotes: 1

pjf
pjf

Reputation: 6009

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.

Upvotes: 15

Keltia
Keltia

Reputation: 14743

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

Upvotes: 4

gpojd
gpojd

Reputation: 23065

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.

Upvotes: 1

mat
mat

Reputation: 13353

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

Upvotes: 4

Marko
Marko

Reputation: 31403

Depends of your definition of framework.

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

Upvotes: 0

Related Questions