Skip to content

Instantly share code, notes, and snippets.

@yko
Created December 20, 2010 19:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yko/748879 to your computer and use it in GitHub Desktop.
Save yko/748879 to your computer and use it in GitHub Desktop.
#!/usr/bin/env perl
use Mojolicious::Lite;
# Your helper
app->helper(test_h => sub {
# $c for controller
my $c = shift;
# $c->app for application
return ref $c->app;
});
get '/' => sub {
my $self = shift;
$self->render('index');
};
app->start;
__DATA__
@@ index.html.ep
% layout 'default';
Okay, here's your app: <%= test_h %>
@@ layouts/default.html.ep
<!doctype html><html>
<head><title>Welcome!</title></head>
<body><%== content %></body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment