Mojo Wonk Blog.

A semi-offical blog dedicated to the Mojolicious web framework

Day 2: The Stash

leather bag

In Mojolicious, when processing a request and preparing a response one of the most important concepts is "the stash". Since it is a non-blocking framework, your code can't use global variables to store any state during processing. If you did and some other code were to run, it could very easily get cross-talk between requests.

The stash is the place you can store information while you process it. It is just a simple hash reference that is attached to the controller object that is processing the request. It lives and dies with that one transaction.

While you can and should use it as a scratchpad, it really is much more. The stash controls almost every aspect of the response that you generate. Let's look a little closer to see how it works

Continue reading Day 2: The Stash...

Day 1: Getting Started

hot air ballons

Start at the Beginning

In this Advent Calendar series, some posts will be introductory, some will be advanced, some will be on new features. Who knows what could be next? But for now let's ensure a level playing field by working out how to get started.

Continue reading Day 1: Getting Started...

Mojolicious Advent 2017

I'm happy to announce that I'll be running a Mojolicious Advent Calendar this year!

For those of you who are unaware, an advent calendar is a way to count down to Christmas through December. In many cases, the act of marking each day also provides a treat, usually chocolate. All told, 24 days are marked, one for each day from Dec 1 to Dec 24, Christmas Eve.

I'm not sure exactly how this moved into coding circles, but there is now a tradition of doing a similar countdown for programmers. The treats are little bits of wisdom on some programming topic.

Perl has http://www.perladvent.org/ which has run for quite a long time. Other calendars have popped up for other languages and I'm told it is even migrating to non-coding maker-type spaces!

This year I've decided that I'd like there to be one for the Mojolicious Web Framework. My desire is partly to put out some common starting tips and tricks and partly due to some recent additions that could really do with some extra publicity (they're cool, just wait!).

At least at the moment it is just me so, in the hopes of actually completing it, some posts might be brief. Some calendars try to use holiday themes in the posts, which I may do it the muse is upon me, but I make no promises.

I hope you'll enjoy no matter what religious or non-religious winter holidays you celebrate!

Introduction

Hello and welcome to the new site!

My name is Joel Berger. I'm on the Core Development team of the Mojolicious web framework.

I guess the immediate question is, why start a new site and blog? This site grew out of ideas I have had to promote the framework, especially outside of the Perl bubble.

The immediate goal is to publish an Advent Calendar focused on Mojolicious. It is a fun tradition and an interesting challenge, blogging once a day for almost a month. The question was where to put it.

Continue reading Introduction...