PerlDancer / Dancer2

Perl Dancer Next Generation (rewrite of Perl Dancer)
http://perldancer.org/
Other
537 stars 272 forks source link

add_route called in a plugin BUILD block will get a prefix that cannot be overridden #1663

Closed GeekRuthie closed 11 months ago

GeekRuthie commented 2 years ago

In Dancer2::Core::App::add_route, putting the prefix => option (line 1230) above the attrs that are given by the caller will let the caller override the prefix.

If you attempt to use $self->app->add_route in a plugin's BUILD block, and your application uses prefixes, it'll probably get one, likely the last prefix statement in your load order, and adding prefix => undef to your add_route call doesn't help.

GeekRuthie commented 2 years ago

Note: I've got a patch for this coming, just adding some tests to t/app.pl to test that it works correctly. :smiley: