package MojoliciousTest; use strict; use warnings; use base 'Mojolicious'; # Let's face it, comedy's a dead art form. Tragedy, now that's funny. sub startup { my $self = shift; # Default router my $r = $self->router; # Test route $r->match('/this/is/a/test/$number', number => qr/\d+/) ->methods(qw/GET POST/) ->to(controller => 'foo', action => 'test', number => 23); # Default route $r->match('/$controller/$action')->to(action => 'index'); } 1; package MojoliciousTest::Foo; use strict; use warnings; use base 'Mojolicious::Controller'; # If you're programmed to jump off a bridge, would you do it? # Let me check my program... Yep. sub test { my $c = shift; $c->res->headers->header('X-Bender', 'Kiss my shiny metal ass!'); $c->render('test.phtml'); } 1;