1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
#!/usr/bin/env perl use Mojolicious::Lite; get '/' => sub { my $c = shift; $c->render(template => 'index'); }; app->start; __DATA__ @@ index.html.ep % layout 'default'; <h1>Welcome to the Mojolicious real-time web framework!</h1> % for my $n (1..6) { <h<%=$n%>>hoge</h<%=$n%>> % } @@ layouts/default.html.ep <!DOCTYPE html> <html> <head><title><%= title %></title></head> <body><%= content %></body> </html>
You can clone a snippet to your computer for local editing. Learn more.