Created
November 17, 2012 18:52
-
-
Save TristinDavis/4098806 to your computer and use it in GitHub Desktop.
Flash/Stash example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for the example. 👍