Still looking for an answer as to the scope of a 'hook before'. Does it affect all of the routes or just the routes within a 'prefix'. My understanding is that Dancer2 does away with the globals found in Dancer thus I would expect that a 'hook before' within a 'prefix' would remain within the scope of the 'prefix' and not flow outside of it into the other routes. But this is not what I find thus I am curious as to if I am doing something wrong or have my concept wrong. Thanks, -- Rick ---- Original message ---- Hello. New Dancer2 user here. I am having problems with the scope of a 'hook before' while using 'prefix'. I am not sure if I am doing something dumb or if this is simply not possible or something else is going on. Using the prefix example from the Cookbook I have two modules package myapp; use Dancer2; use myapp::admin; prefix undef; get '/' => sub { return 'main ' . dancer_version }; 1; And package myapp::admin; use Dancer2 appname => 'myapp'; prefix '/admin'; hook 'before' => sub { if (dancer_app->environment ne 'rick') { return halt; } }; get '/' => sub { return 'admin' }; 1; As expected when running with environment 'rick' then the following output is produced: / ==> main 0.166001 /admin/ ==> admin But, unexpectedly to me, using the default 'development' environment has the app just halting as it, I presume, hits the 'hook before'. I would have expected '/' to return with 'main 0.166001' while '/admin/' to halt. In other words I would expect that the 'hook before' is kept within the scope of the prefix '/admin' and not bleed over to the undef prefix. Any ideas on what is happening? Thanks, -- Rick Westerman westerman@purdue.edu Bioinformatics specialist at the Genomics Facility. Phone: (765) 494-0505 FAX: (765) 496-7255 Department of Horticulture and Landscape Architecture 625 Agriculture Mall Drive West Lafayette, IN 47907-2010 Physically located in room S049, WSLR building