P is for Practical | |
PerlMonks |
Problems with setting session variables in Catalystby LunarCowgirl (Sexton) |
on Aug 11, 2014 at 22:29 UTC ( [id://1097046]=perlquestion: print w/replies, xml ) | Need Help?? |
LunarCowgirl has asked for the wisdom of the Perl Monks concerning the following question: I'm having trouble with session variables in Catalyst. I'm new to Catalyst, so it's likely I don't fully understand how to use Session::Store. I've found, on all the web, only two examples of how to add items to $c->session:
I know $c->session is a hash ref, and I've tried variations on both above. What I'm trying to do is create a hidden token in a form for validation upon POST. This is my GET routine:
I've also tried: push @{ $c->session->{token} }, $token;The contact page won't load when I use either, and it crashes the server, so I get no error or debugging messages to indicate what's happening. I have to kill the server and restart it. If I comment out the line for $c->session, everything works fine. If I uncomment it though, things crash again. The odd thing is that it suddenly starting working with the line uncommented. I had the token set at 512 bits from a copy and paste example. Changing the size to 128 made everything start working. Then, all of a sudden, without any changes to the method, it stopped and I have to comment out the line to get the page to load. Setting the token at 12 bits made no change, so I doubt it had anything to do with the variable size. I'm really confused here. What is the proper way to push a variable into a Catalyst session? Or if I'm doing it right, why is the page crashing the server?
Back to
Seekers of Perl Wisdom
|
|