Friday, December 11, 2015

Dada Mail v9 Released

The latest major release of Dada Mail has been released. Version Nine! 

Dada Mail is an email mailing list manager, written in Perl. Usually in my posts, I go over all the cool things I was able to get accomplished, because of some neat Perl module or technique.

The last major release focuses on redesigning the backend of Dada Mail, and adding support to run it under PSGI/Plack, while also maintaining the ability to run it under CGI. For that, I moved over to CGI::Application.

This release focuses almost explicitly on the front end design and layout -  and for that, I utilized the Zurb Foundation Framework.

I couldn't have imagined how much work moving to Foundation would have taken, when I started. Sling a few <div>'s here and there - right?

Well, wrong - and it wasn't Foundation's fault. Although there is a learning curve to working with their flavor of HTML markup, and a slightly tougher grade to learn their SCSS workflow (and setting up the environment is a little... obtuse) - the real culprit is that the Dada Mail project really pretty large.

Dada Mail has over 300 separate template files that make up all its views, and the project itself was started in 1999.  Let's say you need to make a complicated layout of form fields and such. What do you use?

Well, in 1999 you use tables. And if it ain't broke, why fix it? So tables it was for a lot of the forms that the UI used for all those preference screens. That's fine and good, until you want your app to work well on a mobile phone's browser. Now, everything is legitimately broken, because a lot of the design has fixed widths and isn't very responsive.

To fix a lot of the UI problems meant replacing the table-based layout with Foundation's Grid System.  A lot of my forms had secondary and even tertiary form elements, that needed to be shown underneith other form elements, so that the user knows they're somehow related. After a bit if wrangling, Foundation made this realistic to do.

Here's an example of a somewhat complicated part of form for changing the template of your mailing lists message,

It's pretty phenomenal that this can now be done, with a having to revert to using a table-based layout. The diff file for this release was over 100,000 lines long, which goes to show you just how much HTML I've been working with for the last few months. I have long since separated the HTML out of Dada Mail, so almost nothing had to be modified in the Perl side of things at all, to get things runnin'. For templates, I've been using HTML::Template (and friends) since forever, and probably will keep on chugging - with the most obvious successor being Template-Toolkit, if the need ever arises. I'm not sure if that makes sense for me now, but we'll see what the future holds.


Ron Savage said...

I'm the author of CGI::Snapp, the replacement for CGI::Application.
I'm intrigued you did not choose CGI::Snapp. Can you tell me why? TIA.
Ron Savage

The Perl Hacker Painter said...

cpan deps is down atm, so I'd have to double-check, but it could have been a problem with XS dependencies in CGI::Snapp, that are not there in CGI::Application. I ship Dada Mail as something you can literally download the tarball of, upload to your hosting account and have things just work (think Wordpress) - in other words: The deployment environment pretends there's no cpan/cpanm available. Which is difficult.

If dependencies weren't an issue, I would probably have gone with Mojolicious - In the Grand Plan for this app, using CGI::App was a middle-ground idea to go from no framework to CGI::App to Mojolicious. Mojolicious itself seems attractive on the deps department, but the required version of Perl is a bit greater than what I currently target (5.10.1)

Ron Savage said...

Thanks for responding!

I personally have never written XS, so I can't help with identifying what might have failed there.

I'm not aware of any XS dependencies used by my code which CGI::App does not have, but perhaps there are some indirectly.

As for Mojolicious, it's certainly my choice these days.

Anyway, as long as CGI::App does the job, use it.

Abirami R said...

hi welcome to this blog.really you have post an informative will be really helpful to many peoples.thank you for sharing this blog.
perl online training

Ram Niwas said...

Very interesting blog. Thanks for sharing this much valuable information. Keep Posting.

PERL Scripting Online Training