[Dancer-users] Plugin::Database failed on reconnect

David Precious davidp at preshweb.co.uk
Thu Apr 12 12:20:31 CEST 2012


On Thu, 12 Apr 2012 10:41:05 +0100
David Precious <davidp at preshweb.co.uk> wrote:

> However, as Dancer::Config->settings returns us the actual hashref,
> we're storing a reference; D::P::EscapeHTML, if automatic_esaping is
> enabled, will follow that reference, trampling all over the values of
> the settings. 
> 
> That, needless to say, is Not Good, and is the cause of the problem.
> 
> I think the proper fix is for me to change Dancer::Template::Abstract
> to copy the settings rather than storing a reference - e.g.:
> 
>     $tokens->{settings} = Clone::clone(Dancer::Config->settings);

I've implemented that in a pull request:

https://github.com/sukria/Dancer/pull/775

Please feel free to test that this fixes the issue for you (although I
realise as the problem only manifested once the existing connection
went away, it'll be somewhat tricky to reproduce, unless you can cause
the database connection to drop via whatever means you choose).

I've tested the fix with a simple test case which demonstrated the
previously described problem, and verified that the changes in that PR
do indeed fix it.


-- 
David Precious ("bigpresh") <davidp at preshweb.co.uk>
http://www.preshweb.co.uk/     www.preshweb.co.uk/twitter
www.preshweb.co.uk/linkedin    www.preshweb.co.uk/facebook
www.preshweb.co.uk/cpan        www.preshweb.co.uk/github


More information about the Dancer-users mailing list