Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Dancer CPAN distribution.

Report information
The Basics
Id: 58611
Status: resolved
Priority: 0/
Queue: Dancer

People
Owner: Nobody in particular
Requestors: SYSMON [...] cpan.org
Cc: perl [...] minty.org
AdminCc:

Bug Information
Severity: (no value)
Broken in: 1.1805
Fixed in: (no value)



CC: perl [...] minty.org
Subject: route caching fails to spot new routes
With: * auto_reload: 1 set in environments/development.yaml * the url localhost:3000/barfly * using plackup Given the following two routes defined in the same file get '/barfly' => sub { template 'fly'; }; get '/bar*' => sub { template 'bar'; }; Adding "return pass();" to the top of the barfly route (and without restarting the server) results in the bar* route being shown, as expected. However, removing the entire route for barfly, leaving only the bar* route doesn't cause the server to notice the change and reload the routes. We continue to get the output of fly.tt until the server is reloaded.
Further info. Module::Refresh will refresh regular subs, but it doesn't appear to catch the "routes". get '/' => sub { return spurious(); }; sub spurious { return template 'index', { path => 'test' } } Changing path => 'test' to path => 'foo' WILL be caught, refreshed and works as expected. However get '/' => sub { template 'index', { path => 'test' } }; Changing path => 'test' to path => 'foo' will NOT be caught, and the template will continue to show 'test' for the path variable until the server is restarted.
On Wed Jun 23 14:41:48 2010, SYSMON wrote: Show quoted text
> Changing path => 'test' to path => 'foo' will NOT be caught, and the > template will continue to show 'test' for the path variable until the > server is restarted.
Hi. Thank you for opening the ticket. I think I know where and how to fix it. Would it be possible for you to sum it up for us in a test case? It would help us assure we're fixed the issue and that it will not return. Sawyer.
Sent a pull req via github, but to close the loop here http://github.com/minty/Dancer/commit/1cda47e22f37be9aecb2ff33d54579eb3b4a3203
Hi. After an exhaustive two days in which I gave up for a while, I've finally set down and figured it in roughly 10 minutes. It's one of those things that are in front of us all the time but we don't notice, kind of like butterflies - except butterflies are beautiful. :) The problem is with the test script: 1. You're not sending the same path when calling write_package(), making two different files created, but only one in the correct path - the first one. 2. You're not using the auto_load feature. You accidentally misspelled it as auto_refresh - which is probably because you were thinking "Module::Refresh". I've made a patch to show you this, and it is sitting on your Github commit here: http://github.com/minty/Dancer/commit/1cda47e22f37be9aecb2ff33d54579eb3b 4a3203#commitcomment-131829 Once those issues were gone, the script succeeded. We can now go out and look at butterflies... :) All the best, Sawyer.