Is there a way to pass additional variables to a method handler subroutine? I generally dislike using global variables outside the subroutine's scope. I have things like database connection and class instances which I would like the handlers to have access to, without using globals. Using debug to console, looks like @_ is empty for each handler call.
#!/usr/bin/perl
use strict;
use Dancer;
use Data::Dumper;
set('logger' => 'console');
my $somevar = SomeClass->new();
get('/' => sub{
debug(Dumper(@_));
debug($somevar);
return('hello world');
});