[dancer-users] Geting RuntimeError when calling pass
Henk van Oers
hvo.pm at xs4all.nl
Sun Sep 29 13:38:22 BST 2013
On Sun, 29 Sep 2013, Jonathan Harden wrote:
> I'm using Module::Load to load a module (containing routes) at runtime and then calling pass. If there are no matching routes this causes a
> RuntimeError.
I've never called pass (Don't know if it's a bug).
But let me rewrite your example...
> Example:
>
> $ cat bin/app.pl
> #!/usr/bin/env perl
> use Dancer;
> use Demo;
> dance;
> __END__
So far so good.
> $ cat lib/Demo.pm
> package Demo;
>
> use Dancer qw(:syntax);
load_app 'Monitoring', prefix => '/my/monitoring/prefix';
> true;
> __END__
>
>
> $ cat lib/Monitoring.pm
> package Monitoring;
>
> use Dancer ':syntax';
> get '/' => sub {
my $prefix = prefix;
return "Monitoring Service running on $prefix;
> };
>
> get '/ping' => sub {
> return time;
> };
>
> true;
> __END__
> Calling domain.com/Monitoring/foo results in a Runtime Error where I would have expected to receive a 404 error
That should give a 404 now.
HTH
Henk
More information about the dancer-users
mailing list