in reply to Dancer2 hooks and perl modules
You need to package your module as a plugin to write your own hooks. See Hooks in the Dancer2::Plugin docs for more information.
More simply, if you just want to add code in the before hook of each app, write the code in a subroutine in a module, use that module in both apps, then call the sub from the before hook of each app.
Also, if you create a module with the name package A;, use Dancer2; is sufficient. Save yourself a few characters and don't be redundant with use Dancer2 appname =>'A'; And, that's one less thing to maintain if you ever rename that module.
Cheers!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Dancer2 hooks and perl modules
by clemep8 (Acolyte) on Dec 23, 2020 at 19:58 UTC |