/[SysIface]/lib/SysIface.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 /lib/SysIface.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1 - (hide annotations)
Tue Jun 16 19:33:55 2009 UTC (10 years, 4 months ago) by dpavlin
File size: 785 byte(s)
mojolicious generate app SysIface
1 dpavlin 1 package SysIface;
2    
3     use strict;
4     use warnings;
5    
6     use base 'Mojolicious';
7    
8     our $VERSION = '0.1';
9    
10     # This method will run for each request
11     sub dispatch {
12     my ($self, $c) = @_;
13    
14     # Try to find a static file
15     my $done = $self->static->dispatch($c);
16    
17     # Use routes if we don't have a response yet
18     $done ||= $self->routes->dispatch($c);
19    
20     # Nothing found, serve static file "public/404.html"
21     $self->static->serve_404($c) unless $done;
22     }
23    
24     # This method will run once at server start
25     sub startup {
26     my $self = shift;
27    
28     # Routes
29     my $r = $self->routes;
30    
31     # Default route
32     $r->route('/:controller/:action/:id')
33     ->to(controller => 'example', action => 'welcome', id => 1);
34    
35     # Use our own context class
36     $self->ctx_class('SysIface::Context');
37     }
38    
39     1;

  ViewVC Help
Powered by ViewVC 1.1.26