[dancer-users] Devel::Cover and Dancer

Paul Johnson paul at pjcj.net
Tue Mar 17 10:01:31 GMT 2015


On Tue, Mar 17, 2015 at 11:25:53AM +0200, Gabor Szabo wrote:
> When last time I ran the tests of my Dancer2 based app through Devel::Cover
> it did not provide any report for the routes. If I use names subroutines
> and set them as
> 
> get '/' => \&serve_index;
> sub serve_index {
> }
> 
> then Devel::Cover takes those subs into account.
> 
> Do you know how can I convince Devel::Cover to report properly even with
> anonymous subs?

This is something I still want to fix within Devel::Cover if I can.  But
for now, the best workaround that I have is to put everything into a sub
and call that:

    sub _dancer {

    get '/' => sub {
    }

    get '/login' => sub {
    }

    }

    _dancer;

Not ideal, but perhaps the best of a bad bunch.  Unless anyone has a
better suggestion?

-- 
Paul Johnson - paul at pjcj.net
http://www.pjcj.net


More information about the dancer-users mailing list