[Dancer-users] Runtime error having to do with hooks (which I don't use)

David Precious davidp at preshweb.co.uk
Fri Jun 10 11:29:00 CEST 2011


On Friday 10 June 2011 00:30:57 Brian E. Lozier wrote:
> Well I tracked down one bug that turns out may be a documentation bug.
>  I haven't had time to look really really carefully but I was able to
> reproduce a crash when just starting app.pl if the "hook" syntax is
> wrong.  The docs say you can do this:
> 
> hook before_template sub {
>  # do something
> };
> 
> But you really need to do it like this:
> 8d50158
> hook before_template => sub {
>  # do something
> };
>
> A bunch of the hook documentation is broken, [...]

You're absolutely right, thanks!  Documentation fixed in 8d50158 which will be 
in the next release.

hook before_template sub {...} is of course wrong, as there's no comma (fat or 
otherwise) between two params to hook() (and without the fat comma, 
'before_template' doesn't get auto-quoted, so it's an unknown bareword, too).

> I'm still trying to
> find out the root cause of my original issue (which is why I tried
> using the "hook" syntax instead of declaring the before_template
> directly).

Hopefully I'll get a chance to dig further after $work; so far, I've not been 
able to reproduce the issue you're having.  I think the machine I tested on is 
still on 1.3050, though, so it may be something that changed in 1.3051.  I'll 
try 1.3051 and/or devel and see what happens.

Cheers

Dave P

-- 
David Precious  ("bigpresh")
http://www.preshweb.co.uk/

   "Programming is like sex. One mistake and you have to support
   it for the rest of your life". (Michael Sinz)


More information about the Dancer-users mailing list