Advertisement
mikelieman

Mojo exec test

Aug 23rd, 2019
467
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 0.51 KB | None | 0 0
  1. #!/usr/bin/env perl
  2. use Mojolicious::Lite;
  3.  
  4. get '/' => sub {
  5.         my $c = shift;
  6.  
  7.         my $output = qx{echo "hello there from the shell"};
  8.  
  9.         $c->render(template => 'index', text => $output);
  10. };
  11.  
  12. app->start;
  13. __DATA__
  14.  
  15. @@ index.html.ep
  16. % layout 'default';
  17. % title 'Welcome';
  18. <h1>Welcome to the Mojolicious real-time web framework!</h1>
  19. <p><$= text ></p>
  20.  
  21. @@ layouts/default.html.ep
  22. <!DOCTYPE html>
  23. <html>
  24.   <head><title><%= title %></title></head>
  25.   <body><%= content %></body>
  26. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement