Come for the quick hacks, stay for the epiphanies. | |
PerlMonks |
Re: $c->flash Not Dereferencing Data Objectsby Your Mother (Archbishop) |
on Jul 02, 2020 at 20:35 UTC ( [id://11118839]=note: print w/replies, xml ) | Need Help?? |
I don’t have time to write test code but I think see the problem. You can only use a flash entry once. It’s gone—removed from the session—after that. The entire point is it cannot persist past a single use. Put it in the stash instead—unless you need it to persist past a redirect or something—and you should be fine. And just to be clear, this is actually a Catalyst question, not a DBIx::Class question. The flash/stash is part of the Catalyst context and its session. More detail, when you do if $c->flash->{bio}, you just used it so it’s gone by the time you get to the assignment. Also note, you should never put a conditional on an (update: variable declarative) assignment statement. It can behave strangely.
Update in case you do need it as flash, untested–
Update, added HTML escape filters. Been ages since I did Mason. :P NEVER trust user input.
In Section
Seekers of Perl Wisdom
|
|