[dancer-users] Custom hook in a plugin in Dancer2

Cymon cymon at tiscali.it
Sun Jun 2 21:54:11 BST 2013


Hi all,
I'm trying to add a custom hook to a little plugin and I'm not able to
understand what i'm missing.

I thought it was just to add 

register_hook 'MY_NEW_HOOK'

in the plugin and

execute_hook 'MY_NEW_HOOK', @PARAMS

where i want it fired.

No syntax error is detected when I start developement server but when I
go on the page that has to execute the hook I have:

Internal Server Error

Hook 'MY_NEW_HOOK' does not exist
at .../lib/perl5/Dancer2/Plugin.pm
line 192.

I tryed also to follow what is written here:
http://search.cpan.org/~sukria/Dancer2-0.04/lib/Dancer2/Core/Hook.pm

# inside a plugin
use Dancer2::Hook;
Dancer2::Hook->register_hooks_name(qw/before_auth after_auth/);

but it doesn't work too. 
I also think that something is wrong there because Dancer2::Hook is not
the right path of the library...

Someone can explain me what i'm doing wrong?

Thanks,
-- 
Cymon
Coniglio domina,
http://www.therabbit.it


More information about the dancer-users mailing list