On Thu, Apr 27, 2017 at 2:59 PM, ivo welch <[email protected]> wrote:
> thanks, stefan. This will do if need be, but I was hoping there was a way > to tell the app the cookie method right from start, rather than sticking > this into each and every url. I imagine you could leverage a hook <http://mojolicious.org/perldoc/Mojolicious#HOOKS>, like after_dispatch <http://mojolicious.org/perldoc/Mojolicious#after_dispatch>: hook after_dispatch => sub { my $c = shift; $c->app->sessions->cookie_domain(getfinaltwo($c->req->url->to_abs->host)); }; get '/1' => sub { my $c = shift; $c->session(a=>1)->render(text=>"\n"); }; get '/2' => sub { my $c = shift; $c->session(b=>2)->render(text=>"\n"); }; app->start; sub getfinaltwo { shift =~ s!^.*?((\.[^\.]+){2})$!$1!r } -- You received this message because you are subscribed to the Google Groups "Mojolicious" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/mojolicious. For more options, visit https://groups.google.com/d/optout.
