Skip to content

Instantly share code, notes, and snippets.

@TristinDavis
Created November 17, 2012 18:52
Show Gist options
  • Save TristinDavis/4098806 to your computer and use it in GitHub Desktop.
Save TristinDavis/4098806 to your computer and use it in GitHub Desktop.
Flash/Stash example
use Mojo::ByteStream;
app->helper(alerts => sub {
my $c = shift;
my $html = '';
for my $message (qw|success info error|) {
my $css = "alert alert-$message";
if($c->flash($message)) {
$html .= $c->tag('div', class => $css, $c->flash($message));
}
if($c->stash($message)) {
$html .= $c->tag('div', class => $css, $c->stash($message));
}
}
b($html);
});
@priojeet-deriv
Copy link

Thanks for the example. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment