Parent Directory | Revision Log
r3085@llin (orig r231): dpavlin | 2008-11-01 14:20:25 +0100 Mojolicous skeleton mojolicious generate app Frey::Mojo
1 | package Frey::Mojo::Example; |
2 | |
3 | use strict; |
4 | use warnings; |
5 | |
6 | use base 'Mojolicious::Controller'; |
7 | |
8 | # This is a templateless action |
9 | sub test { |
10 | my ($self, $c) = @_; |
11 | |
12 | # Response object |
13 | my $res = $c->res; |
14 | |
15 | # Code |
16 | $res->code(200); |
17 | |
18 | # Headers |
19 | $res->headers->content_type('text/html'); |
20 | |
21 | # Content |
22 | my $url = $c->url_for; |
23 | $url->path->parse('/index.html'); |
24 | $res->body(qq/<a href="$url">Forward to a static document.<\/a>/); |
25 | } |
26 | |
27 | # This action will render a template |
28 | sub welcome { |
29 | my ($self, $c) = @_; |
30 | |
31 | # Render the template |
32 | $c->render; |
33 | } |
34 | |
35 | 1; |
ViewVC Help | |
Powered by ViewVC 1.1.26 |