Created
September 29, 2013 16:31
-
-
Save ian-kent/6754064 to your computer and use it in GitHub Desktop.
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/env perl | |
use Mojolicious::Lite; | |
my $r = app->routes; | |
$r->get('/')->to(cb => sub { | |
my $self = shift; | |
$self->render(text => 'test'); | |
}); | |
my $b = $r->bridge('/#arg1/#arg2')->to(cb => sub { | |
warn "In first bridge"; | |
return 1; | |
}); | |
$b->bridge('/#branch/')->to(cb => sub { | |
# do something here | |
warn "In second bridge"; | |
return 1; | |
})->get->to(cb => sub { | |
my ($self) = @_; | |
$self->render(text => 'Branch: ' . $self->stash('branch')); | |
}); | |
$b->bridge('/#branch/*dir_name')->to(cb => sub { | |
warn "In third bridge"; | |
return 1; | |
})->get->to(cb => sub { | |
my $self = shift; | |
$self->render(text => 'Branch: ' . $self->stash('branch') . '<br />' . 'Dir name: ' . $self->stash('dir_name')); | |
}); | |
app->start; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment