Created
December 31, 2014 19:50
-
-
Save briandfoy/5a819d18d5032370ce75 to your computer and use it in GitHub Desktop.
This file contains 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
#!/usr/bin/env perl | |
BEGIN { | |
my $home = $ENV{HOME}; | |
%ENV = (); | |
$ENV{PATH} = '/usr/bin:/usr/local/bin'; | |
$ENV{HOME} = $home; | |
} | |
use Mojolicious::Lite; | |
use Data::Dumper; | |
app->config( | |
hypnotoad => { | |
listen => ['http://*:80'], | |
workers => 5, | |
}, | |
); | |
get '/' => sub { | |
my $c = shift; | |
$c->stash( pid => $$ ); | |
$c->stash( env => Dumper(\%ENV) ); | |
$c->stash( app => Dumper( app() ) ); | |
$c->render('index'); | |
}; | |
app->start; | |
say "Done"; | |
__DATA__ | |
@@ index.html.ep | |
% layout 'default'; | |
% title 'Welcome'; | |
<p>Welcome to the Mojolicious real-time web framework!</p> | |
<p>PID: <%= $pid %></p> | |
<pre> | |
<%= $env %> | |
</pre> | |
<pre> | |
<%= $app %> | |
</pre> | |
@@ 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