Closed cxw42 closed 3 years ago
@cxw42 there is no difference since DSL's hook
results in this being called under the hood:
$self->app->add_hook(
Dancer2::Core::Hook->new( name => $name, code => $code ) );
I you feel like create a PR then it will get my approval at least.
Closing. Would still entertain a PR should @cxw42 feel motivated :)
The docs for Dancer2::Plugin show using
$self->app->add_hook
to add a hook:https://github.com/PerlDancer/Dancer2/blob/84665e58df52eafc85151652b95017ddab1cfe20/lib/Dancer2/Plugin.pm#L650-L656
However, I just learned from the 2016 Advent calendar that you can use DSL via
$self->dsl->hook
. I tried it with good success (here).Is there any underlying difference, in a Dancer2 plugin, between
$self->app->add_hook
and$self->dsl->hook
? Any reason to prefer one over the other? If there is no difference or reason, any objection to a PR updating the Dancer2::Plugin docs to feature the latter, more concise form?Thanks!