Skip to content

Instantly share code, notes, and snippets.

@sharifulin
Created January 20, 2010 22:53
Show Gist options
  • Save sharifulin/282378 to your computer and use it in GitHub Desktop.
Save sharifulin/282378 to your computer and use it in GitHub Desktop.
Mojo: bug in routes
#!/usr/bin/perl
use strict;
use lib qw(lib ../mojo/lib);
$ENV{MOJO_APP} ||= 'App';
use Mojolicious::Commands; Mojolicious::Commands->start;
package App;
use strict;
use base 'Mojolicious';
sub startup {
my $self = shift;
my $r = $self->routes;
$r->route('/test' )->to('test#show'); # OK
$r->route('/test1')->to(controller => 'test-test', action => 'show'); # OK
$r->route('/test2')->to('test-test#show'); # ERROR
}
1;
package App::Test;
use strict;
use base 'Mojolicious::Controller';
sub show { shift->render_text('Test!') }
1;
package App::Test::Test;
use strict;
use base 'Mojolicious::Controller';
sub show { shift->render_text('Test Test!') }
1;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment