|Just another Perl shrine|
Multiple cookies in Catalyst, one longlasting and one session cookieby martell (Hermit)
|on Jan 29, 2017 at 13:45 UTC||Need Help??|
martell has asked for the wisdom of the Perl Monks concerning the following question:
In Europe websites should ask the visitors if they allow storing of cookies on their browsers. So before you can send a cookie, you are obliged to give a notice with the explanation of what your cookie does and how information is used. The famous cookie-law. It is under review, but still applicable at this moment. Because my website is European based, it should be conform with this.
My site, using Catalyst, is using session cookies according the book via the plugins:
Today I use a variable in the session that tracks if the user already has given his/her permission to use the cookie. However because a session only last an hour, this is annoying for the user to every time he visits my site to give permission again. This leads me to following question:
How can I set an additional long lasting cookie beside my standard session cookie?
This long lasting cookie would have a life span of 3 months and indicate that the user already had been given the notice and it shouldn't be given again until he deletes the cookie or has not been on my site for 3 months.
Because Catalyst handles sessions transparent for me, I have no clue how to create and check this additional cookie. And searching for cookie and Catalyst returns me always back to Session::State::Cookie without addressing the two cookie problem.
So any ideas or links to tutorials that I can use to realise this?