/[Frey]/branches/mojo/lib/Frey/Mojo/Example.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Annotation of /branches/mojo/lib/Frey/Mojo/Example.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 231 - (hide annotations)
Sat Nov 1 13:20:25 2008 UTC (15 years, 5 months ago) by dpavlin
File size: 581 byte(s)
Mojolicous skeleton

mojolicious generate app Frey::Mojo
1 dpavlin 231 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