pmfl
pmfl

Reputation: 2099

How to replace Mojolicious sessions with a custom implementation?

By default Mojolicious sessions create a signed cookie for the session. I would like to override this behavior. I can extend Mojolicious::Sessions and override the load and store methods, but how do I use my class instead of the default Mojolicious::Sessions.

Upvotes: 1

Views: 375

Answers (1)

Joel Berger
Joel Berger

Reputation: 20280

As documented, the Mojolicious::Sessions object is held in the app's sessions property. Therefore you can either override it on creation

my $app = MyApp->new( sessions => MySessions->new );

or afterward

$app->sessions( MySessions->new );

Upvotes: 5

Related Questions