My experiences with Mason (which I like quite a bit):

If you're careful with your coding style, it's not too hard to achieve a separation of perl and html with Mason. You can write Mason components that seem like html to the html monkeys, so they don't feel disenfranchised. As other people have mentioned, keeping as much of your code as possible in modules is key -- for one thing, it makes it very easy to write stand-alone tests of the code.

Just working on projects on my own, I feel the strong temptation to move all the content into the database, so I end up writing very few mason components -- you can do a lot with an autohandler and a dhandler and a header and footer component.

Of course, the down side of working this way is you're also going to need some CMS-features to edit the content in the database, and how much time do you want to put into reinventing Bricolage? Bundle::Bricolage

Some technical hints:

Take a few minutes to wrap your brain around the "autohandler" and "dhandler" concepts. A "dhandler" is called if the request doesn't find what it's looking for, an "autohandler" is called after something is found, but before evaluating it. A typical request cycle for me is a request comes in for something that's not on the filesystem, so the dhandler takes it, then Mason backs-up and finds the autohandler, which calls my header component, then does a "call_next" to insert the material returned from the dhandler, after which the autohandler calls my footer component to finish the generated page.

By the way, getting Mason to deal with empty directories correctly is a minor headache. I strongly suggest reading this page from the wiki: HandlingDirectoriesWithDhandlers


In reply to Re: Experiences With Mason by doom
in thread Experiences With Mason by zerohero

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.