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

David Precious davidp at preshweb.co.uk
Thu Jun 9 20:53:34 CEST 2011


On Thursday 09 June 2011 15:34:33 Brian E. Lozier wrote:
> Interestingly, the first request after I start it works, but any
> subsequent request gives a runtime error like this:
> 
> runtime error
> 
> Can't use string ("") as a subroutine ref while "strict refs" in use
> at /usr/local/lib/perl5/site_perl/5.12.2/Dancer/Factory/Hook.pm line
> 62.
> 
> /usr/local/lib/perl5/site_perl/5.12.2/Dancer/Factory/Hook.pm around line 62
> 
> 59         croak("The hook '$hook_name' doesn't exists");
> 60     }
> 61
> 62    $_->(@args) foreach @{$self->get_hooks_for($hook_name)};
> 63 }
> 64
> 65 sub get_hooks_for {
> 
> Does this look familiar to anyone?  I am not using any of the hook
> functionality whatsoever.  I grepped my entire codebase for the word
> "hook" and didn't find any instances.  I'm digging into Dancer now but
> figured someone may have seen this before.
[...]

> I tracked this down to a "before_template" sub that I have defined:
[...] 
> If I comment this out everything keeps running across multiple
> requests (but obviously my app isn't working properly with this stuff
> missing).

I'm looking in to this one now and trying to reproduce it.

So far, I've created a scaffolded app from afresh, added a before_template 
handler:

before_template sub { debug "In before_template handler"; };

... then executed it (and refreshed a few times) and cannot reproduce the 
problem.

Could you (a) let us know what version of Dancer you're using, and (b) try the 
above to create a test case and see if you still get the problem with that?

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