Status (flash) messages

76 views
Skip to first unread message

Michele Beltrame

unread,
Aug 10, 2016, 10:20:28 AM8/10/16
to Mojolicious
Hello all!

I'm beginning to dig into Mojolicious (wonderful framework, by the way)
by developing a fairly complex web application.

I'm trying to understand how to handle success and error messages in
pages of my web application. I see that Mojolicious has flash(), like
Catalyst has. In Catalyst, this was however prone to possible race
conditions (wrong status message displayed in wrong tab or so).

With Catalyst, I use Catalyst::Plugin::StatusMessage, which seems to do
a good job.

Does anything similar exists for Mojolicious? Or are my worries without
any foundation?

Thanks!
Michele.

--
Michele Beltrame
http://www.italpro.net/ - m...@italpro.net
Skype: arthas77 - Twitter: _arthas

jay m

unread,
Aug 11, 2016, 1:25:29 PM8/11/16
to Mojolicious
we use this pattern all the time with hypnotoad deployments, and haven't seen any race conditions

we use a helper to insert a div with one of the bootstrap classes alert-info/danger/success,
based on existence of flash (or stash) keys alert-info/error/success

hope this helps
jay

Michele Beltrame

unread,
Aug 16, 2016, 5:48:06 AM8/16/16
to mojol...@googlegroups.com
Hello Jay!

> we use this pattern all the time with hypnotoad deployments, and haven't
> seen any race conditions
> we use a helper to insert a div with one of the bootstrap classes
> alert-info/danger/success,
> based on existence of flash (or stash) keys alert-info/error/success

Thank you for the response.

I am especially concerned about async request made by pages open in
other tabs, which could prevent some messages from showing. It however
seems like a not-too-likely situation.

I'll go with "flash" myself, and see what happens. If it doesn't work
out, I'll try to "port" Catalyst's StatusMessage plugin to Mojolicious.

Thanks,
Reply all
Reply to author
Forward
0 new messages