At the last two Perl QA Hackathons, I worked on porting PAUSE on Plack, to drop old mod_perl and Apache dependencies and make it easier to set up PAUSE on your local environment. It was successful, but more could be done to fix various (visual/security/usability) issues on PAUSE UI. So, at the rebranded Perl Toolchain Summit of this year, I went a step (or a few steps) further and started to port PAUSE on Mojolicious, hoping to separate views from controllers and make it clearer for us which code belongs to which feature(s) and how.

You might wonder why I chose Mojolicious, instead of a plain template engine just to separate views from controllers, or a few other frameworks. I can think of several reasons. I've been using Mojolicious since its earliest days and I've already used it to rewrite CPANTS Web. Mojolicious is PSGI-compliant and as long as we stick to PSGI features, we don't need to change lower layers. Using a new template engine means almost all pages need to be modified anyway, and compared with the cost of this template migration, migration costs for new router/dispatcher/file layout are rather trivial. But probably the biggest reason was I had several days I could use before the summit this year, namely so-called "Golden Week" (a series of Japnaese national holidays). If things went wrong, I could redo what I did differently at the summit.

I started porting PAUSE on Mojolicious on May 2, under my private repository as I did two years ago. To avoid conflicts, I made a new directory called pause_2017, and built a skeleton with a set of controllers with empty actions, corresponding empty templates as well as routes to map them. Then I took what was necessary for me to visit all the PAUSE menus from pause_1999, and started copying business logic of each page into an appropriate action method in an appropriate controller, and visual components into templates. Before I left for Lyon, all but a few big pages had the same look as those in pause_1999, though I couldn't assure they worked correctly as well. I had written a test to make sure all the GET requests returned 200 without leaving "deadmeat" (ie. broken XHTML page), but that was hardly enough. I also needed to monkey-patch Mojolicious::Plugin::TagHelpers to let it create XHTML tags, which suggested that migration would take more time than I had expected.

On the day 1 at the summit, I asked Andreas König for the necessary permission and he kindly encouraged me to go on my work. I explained briefly that I was porting under a different directory and he didn't need to worry about conflicts, and what Mojolicious templates and file layout looked like. I also asked him if we really need some of the old admin features, and he assured me I didn't need to copy some of the last remaining bits. I removed several features from my port, and worked on the last a few pages. I also asked Joel Berger (one of the core developers of Mojolicious) for a better practice to compose emails with Mojolicious templates, and started porting emails as well.

I kept on using my private repository while I was moving things round and round, but as Peter Sergeant offered me some help, I spent most of the day 2 on testing and fixing porting bugs so that I could push more stable code to GitHub, and created a TODO file to share ideas with him.

Day 3 was rather short for me because I attended two group discussions. I pushed "mojo_wip" branch to https://github.com/charsbar/pause/ at the beginning of the day, and made it the default branch for me. Soon afterwards Peter sent me a pull request for my tests to reuse testing modules he wrote for pause_1999 at the previous QA Hackathon, which was really awesome.

Peter sent me two more pull requests on day 4, which revealed that I needed to monkey-patch another Mojo component for now. So I asked Andreas for his preferences, and agreed we didn't need to stick to XHTML, nor table layout, and we didn't need to care about ancient browsers which didn't support PNG, UTF-8, nor https anymore. We also discussed another security issue we'd known for a few years, which was left as a TODO again.

Now it was obvious that I wouldn't be able to finish everything at the summit, I started looking at the PTS wiki and GitHub issues to see if there's anything I could do for PAUSE by the end of the day. I found some and asked Neil Bowers for exactly what he wanted. One of them was a regression caused by the deprecation of module registration. I sent a pull request to Andreas' master, and merged it myself with the nod from Andreas.

Aside from PAUSE, I replaced a CPANTS metric called "previous package_version_matches_dist_version" with more specific "main_module_version_matches_dist_version", thanks to a request from Karen Etheridge. I also talked with Shoichi Kaji about CPAN::Common::Index and other stuff, and with H. Merijn Brand about Text::CSV(_PP|XS) for significant part of Text::CSV_PP is taken almost verbatim from pure perl part of Text::CSV_XS.

Many thanks to Neil Bowers, Philippe Bruhat, and Laurent Boivin for organizing this event, and to Wendy Van Dijk for food and kindness, and to our generous sponsors: Booking.com, ActiveState, cPanel, FastMail, MaxMind, Perl Careers, MongoDB, SureVoIP, Campus Explorer, Bytemark, CAPSiDE, Charlie Gonzalez, Elastic, OpusVL, Perl Services, Procura, XS4ALL, Oetiker+Partner.

