rbjnet has asked for the wisdom of the Perl Monks concerning the following question:

I've used mason in conjunction with perl and apache to create websites that interact with a relational database in the past but it has been several years since I've had a project such as this. My question is is mason still the best glue to use to talk to the db using perl via Apache? This is for a very lightweight project and I'm trying to adhere to the KISS principle. Mason was a very nice way to do this sort of thing back in 2005 or so, is it still the best tool? Thanks in advance...

Replies are listed 'Best First'.
Re: Perl and Mason
by jeffa (Bishop) on Dec 12, 2011 at 19:54 UTC

    There are many shops (in New York City at least) that still use Mason. Shutterstock being one of the ones i used to work on. While the infamous John Napiorkowski is working to port a number of web apps within the company over to the Catalyst framework, the bulk of the code still is and probably will be Mason based. Travis Beck and myself refactored a lot of non-Web based business rules out of Mason components and into Moose objects, and then used those Mason components to only handle Web stuff (form processing, redirection, etc.). This was a huge boon, and leaves me with a conclusion that Mason, while not as savvy as Catalyst is still a viably modern and robust solution. My current employer uses Catalyst and Moose, for what it is worth.

    As always, your millage may vary and the responsibility of keeping the various parts of MVC separated is still very much up to you.

    jeffa

    L-LL-L--L-LL-L--L-LL-L--
    -R--R-RR-R--R-RR-R--R-RR
    B--B--B--B--B--B--B--B--
    H---H---H---H---H---H---
    (the triplet paradiddle with high-hat)
    
Re: Perl and Mason
by CountZero (Bishop) on Dec 12, 2011 at 21:22 UTC
    Dancer is a lightweight web-app which uses either DBI or DBIx::Class for database connectivity and can render your pages through its own simple internal templating engine or through Template::Toolkit.

    Dancer::Template::Mason and Dancer::Template::Mason2 installs Mason or Mason2 as the templating engine.

    If you want simple check it out!

    CountZero

    A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

Re: Perl and Mason
by Anonymous Monk on Dec 12, 2011 at 20:27 UTC

    If you have a HTML::Mason installed and a web server configured for it, do go ahead. Plus, Mason2 was released about half a year or so ago, and it may be worth installing and figuring out the new ropes. Most of these new frameworks use PSGI/Plack as their primary deployment channel and it will require some web server configuration.

Re: Perl and Mason
by grantm (Parson) on Dec 14, 2011 at 21:14 UTC

    Is it "the best" tool? - that will really depend on your situation and the fact that you're already familiar with it is a plus. It is certainly a valid choice and one that I'm using in production. One place where Mason wins over some other templating solutions is that you can configure HTML escaping to be on by default which is a really really good idea.