[Dancer-users] forward() and prefix
Alessandro Ranellucci
aar at cpan.org
Fri May 18 10:21:16 CEST 2012
Hello dancers,
it looks like forward() doesn't imply the application prefix.
This might even be a regression, but I'm not sure about this.
For example:
===
load_app 'Foo::Bar', prefix => '/foo';
package Foo::Bar;
use Dancer ':syntax';
get '/' => sub { forward '/baz' };
get '/baz' => sub { "Hello world" };
===
Calls to /foo/ from outside are correctly routed to the first
handler, but then the forward fails because /baz is not
internally prepended with the application prefix.
A workaround is to add the prefix to the path supplied to
forward() explicitely but this violates encapsulation.
I think forward() should just prepend its first argument with
the current application prefix before trying to route the request.
Opinions? :)
- Alessandro
More information about the Dancer-users
mailing list