Advertisement
Guest User

Untitled

a guest
Sep 26th, 2014
232
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.32 KB | None | 0 0
  1. #!/usr/bin/env perl
  2. use Mojolicious::Lite;
  3. use utf8;
  4.  
  5. get '/' => sub {
  6. my $c = shift;
  7. $c->render('index');
  8. };
  9.  
  10. app->start;
  11. __DATA__
  12.  
  13. @@ index.html.ep
  14. % layout 'default';
  15. % title 'Welcome';
  16. Welcome to the Mojolicious real-time web framework!
  17.  
  18. @@ layouts/default.html.ep
  19. % use Mojo::JSON qw/j/;
  20. <!DOCTYPE html>
  21. <html>
  22. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  23. <head><title><%= title %></title></head>
  24. <body><%= content %></body>
  25. абц <%== j({x => 'абц'}) %>;
  26. </html>
  27.  
  28.  
  29. --------------------------------------------
  30.  
  31. curl -v http://localhost:3000/
  32. * Hostname was NOT found in DNS cache
  33. * Trying 127.0.0.1...
  34. * Connected to localhost (127.0.0.1) port 3000 (#0)
  35. > GET / HTTP/1.1
  36. > User-Agent: curl/7.36.0
  37. > Host: localhost:3000
  38. > Accept: */*
  39. >
  40. < HTTP/1.1 200 OK
  41. * Server Mojolicious (Perl) is not blacklisted
  42. < Server: Mojolicious (Perl)
  43. < Date: Fri, 26 Sep 2014 15:44:22 GMT
  44. < Content-Type: text/html;charset=UTF-8
  45. < Connection: keep-alive
  46. < Content-Length: 240
  47. <
  48. <!DOCTYPE html>
  49. <html>
  50. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  51. <head><title>Welcome</title></head>
  52. <body>Welcome to the Mojolicious real-time web framework!
  53. </body>
  54. абц {"x":"абц"};
  55. </html>
  56. * Connection #0 to host localhost left intact
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement