Skip to content

Instantly share code, notes, and snippets.

@briandfoy
Created December 31, 2014 19:50
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 briandfoy/5a819d18d5032370ce75 to your computer and use it in GitHub Desktop.
Save briandfoy/5a819d18d5032370ce75 to your computer and use it in GitHub Desktop.
#!/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