Created
May 24, 2010 15:37
-
-
Save sharifulin/412016 to your computer and use it in GitHub Desktop.
Mojolicious routes: bridge
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use common::sense; | |
use lib qw(../lib lib); | |
$ENV{MOJO_APP} ||= 'App'; | |
use Mojolicious::Commands; Mojolicious::Commands->start; | |
package App; | |
use common::sense; | |
use base 'Mojolicious'; | |
sub startup { | |
my $self = shift; | |
my $r = $self->routes; | |
my $auth = $r->bridge->to('auth#check'); | |
$auth->route('/about/')->to('pref#about'); | |
$auth->route('/gift/')->to('gift#index'); | |
my $album = $auth->bridge->to('album#allow'); | |
$album->route('/album/create/')->to('album#create'); | |
} | |
package App::Auth; | |
use base 'Mojolicious::Controller'; | |
sub check { 1 } | |
package App::Album; | |
use base 'Mojolicious::Controller'; | |
sub allow { 1 } | |
sub create { shift->render_text(__PACKAGE__) } | |
package App::Gift; | |
use base 'Mojolicious::Controller'; | |
sub index { shift->render_text(__PACKAGE__) } | |
1; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment