Mason

Paul Johnson paul at pjcj.net
Wed Feb 29 23:45:24 GMT 2012


On Wed, Feb 29, 2012 at 06:21:04PM +0000, Jones, Christopher wrote:
> On 29 Feb 2012, at 17:11, Leo Lapworth wrote:
> 
> > Quoting Christopher Jones <c.jones at ucl.ac.uk>:
> > 
> >> I'm looking for a decent book to help get me up to speed with Mason but
> >> could only find "Embedding Perl in HTML with Mason" on Amazon - a paper
> >> edition from 2002 and a more recent 2010 edition on Kindle only.
> > 
> > Mason 2 was released:  Feb 16, 2011 - I'm guessing (but don't know)
> > that it changed quite a bit.
> > 
> > Personally I use Plack + Template toolkit + Catalyst mostly.
> > 
> > But not sure _why_ you want to learn Mason, if it's for an existing site then
> > the book may be of use.
> 
> New job, old tricks new to old dog....
> 
> Have to confess, I didn't realise Mason (1) was quite *that* old....

I've learnt enough Mason in the last year to keep an old site up and
running and extend it as required before it gets replaced by a .net
system.  (Yeah, yeah.)  From my point of view, there's little to
recommend using Mason nowadays.  Mason 1 that is, I have no knowledge of
Mason 2.

The only advantage I can think of is that you might like its templating
system.  Personally, I don't really, but I can believe that others
might.

Disadvantages are that it's tied to mod_perl.  I believe that means that
you can't bring plack into the equation which, in turn, means that you
can't take advantage of the plack middleware.  I'd be pleased to be
shown that I'm mistaken here.

Additionally, each template is in the same namespace, and is basically
the body of a subroutine.  This essentially means that you can't use
named subroutines in templates.  You can look on this as encouragement
to move your logic into modules but, as Leo notes, the other side is
that the components can get very messy if you don't heed this
encouragement.

And then I had to hack Mason itself in order to get code coverage
information from the components.

I managed alright with the online book that Dave mentioned, but I wasn't
trying to learn it thoroughly - just well enough.

My best tip, if you need to work with Mason, is to look at the compiled
code in the mason_cache directory to see what's really happening.

-- 
Paul Johnson - paul at pjcj.net
http://www.pjcj.net


More information about the london.pm mailing list