Skip to content

Instantly share code, notes, and snippets.

@zpmorgan
Created August 23, 2012 03:29
Show Gist options
  • Save zpmorgan/3431889 to your computer and use it in GitHub Desktop.
Save zpmorgan/3431889 to your computer and use it in GitHub Desktop.
mojo url fail?
#!/usr/bin/env perl
use Mojolicious::Lite;
# Documentation browser under "/perldoc"
plugin 'PODRenderer';
get '/' => sub {
my $self = shift;
$self->render('index', url => $self->req->url);
};
app->start;
__DATA__
@@ index.html.ep
% layout 'default';
% title 'Welcome';
Welcome to the Mojolicious real-time web framework!
<br /> port: <%= stash('url')->port %>
<br /> host: <%= stash('url')->host %>
<br /> path: <%= stash('url')->path %>
<br /> base: <%= stash('url')->base %>
@@ layouts/default.html.ep
<!DOCTYPE html>
<html>
<head><title><%= title %></title></head>
<body><%= content %></body>
</html>
Welcome to the Mojolicious real-time web framework!
port:
host:
path: /
base: http://127.0.0.1:3000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment