Skip to content

Instantly share code, notes, and snippets.

@note103
Created March 22, 2014 11:25
Show Gist options
  • Select an option

  • Save note103/9705533 to your computer and use it in GitHub Desktop.

Select an option

Save note103/9705533 to your computer and use it in GitHub Desktop.
#!/usr/bin/env perl
use Mojolicious::Lite;
get '/' => sub {
my $self = shift;
$self->stash(title => 'fizzbuzz_practice');
$self->render('index');
};
app->start;
__DATA__
@@ index.html.ep
% layout 'default';
% for my $str (1..100) {
% if ($str % 3 == 0 && $str % 5 ==0) {
fizzbuzz
<br>
% } elsif ($str % 3 == 0) {
fizz
<br>
% } elsif ($str % 5 == 0) {
buzz
<br>
% } else {
%= $str
<br>
% }
% }
@@ layouts/default.html.ep
<!DOCTYPE html>
<html>
<head><title><%= title %></title></head>
<body><%= content %></body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment