polettix/Dancer-Plugin-FlashNote — pull request #3 by fgabolde (2012-09-12 10:04:14+00:00)
Title: Fix bug when session is not in-memory

Hello,

I had some problems with the plugin where the message would never be stored in the session hash, and when forced inside by hand, would never be dequeued either.

After a very rudimentary examination, it seems not to happen when the session setting is not set, or when it is set to Simple; but at $work we use YAML for very simple apps and more complex backends for the rest and the problem happened every time.

My guess is that

```perl
my $foo = session('foo');
modify_in_place($foo);
```

works for in-memory sessions because you're manipulating the reference directly; for YAML and other types the value returned by their implementation of retrieve() has likely just been deserialized, so you need to write it back.

Hopefully these changesets fix the problem.