/[Frey]/branches/zimbardo/lib/Frey/Mojo.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/zimbardo/lib/Frey/Mojo.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 272 - (hide annotations)
Wed Nov 5 08:20:46 2008 UTC (15 years, 6 months ago) by dpavlin
Original Path: trunk/lib/Frey/Mojo.pm
File size: 985 byte(s)
 r3092@llin (orig r238):  dpavlin | 2008-11-01 17:44:32 +0100
 somewhat working class browser

1 dpavlin 267 package Frey::Mojo;
2    
3     use strict;
4     use warnings;
5    
6     use base 'Mojolicious';
7    
8     # This method will run for each request
9     sub dispatch {
10     my ($self, $c) = @_;
11    
12     # Try to find a static file
13     $self->static->dispatch($c);
14    
15     # Use routes if we don't have a response code yet
16     $self->routes->dispatch($c) unless $c->res->code;
17    
18     # Nothing found
19     unless ($c->res->code) {
20     $self->static->serve($c, '/404.html');
21     $c->res->code(404);
22     }
23     }
24    
25     # This method will run once at server start
26     sub startup {
27     my $self = shift;
28    
29     # The routes
30     my $r = $self->routes;
31    
32 dpavlin 272 # $r->route('/:action/:class/:controller')
33     # ->to(controller => 'run', action => 'markup', class => 'Frey::ClassBrowser' );
34    
35     $r->route('/x/:class/:controller/:action')
36     ->to(controller => 'run', action => 'markup', class => 'Frey::Inspector' );
37    
38 dpavlin 267 # Default route
39 dpavlin 272 $r->route('/:class/:action/:controller')
40     ->to(controller => 'run', action => 'markup', class => 'Frey::ClassBrowser');
41 dpavlin 267 }
42    
43     1;

  ViewVC Help
Powered by ViewVC 1.1.26