6 Aug
2015
6 Aug
'15
9:30 p.m.
Am 06.08.15 um 13:08 schrieb Henk van Tijen ||: […]
To be more specific, I intend to structure my app along route definitions like:
use MyDancer::Controller::FoobarController; get ‘/Foobar/jump’ => sub { my $fb = FoobarController->new; $fb->jump; };
Is this okay or ‘ugh’ ?
With this, you'd create a new instance of MyDancer::Controller::FoobarController for *every* request, this is definitively 'ugh'. If your controller does not hold any state, you can skip the whole OO thing, and just call a sub in another package: use MyDancer::Controller::FoobarController; get '/Foobar/jump' => sub { MyDancer::Controller::FoobarController::jump(); }; Jochen