Hi
That doesn't compile
Also, it is still incomplete
Still, if I go ahead and fill in the blanks by copying dancer2 -a HookTest I think I see what you see
You should read https://metacpan.org/pod/Dancer2::Plugin#Writing-the-plugin
This triggers
package TestHook; use Dancer2::Plugin; sub BUILD { my( $plugin ) = @_; $plugin->app->add_route( method => 'get', regexp => '/die', code => sub { die "get '/die' => sub { " }, ); $plugin->app->add_route( method => 'get', regexp => '/ride', code => sub { 'ride' }, ); $plugin->app->add_hook( Dancer2::Core::Hook->new( name => 'after_error', #~ code => sub { $_[0]->content( $_[0]->content . " ... please +?" ) } code => sub { my $content = shift; warn ' From TestHook From TestHook From TestHo +ok From TestHook From TestHook '; $content->{content} .= " hello world From TestHook + "; } )); } 1; __END__
In reply to Re^7: Dancer2 hook ( Dancer2::Plugin BUILD)
by Anonymous Monk
in thread Dancer2 hook
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |