]> git.koha-community.org Git - koha.git/blob - Koha/Middleware/UserEnv.pm
Bug 36149: (follow-up) POD and tidy
[koha.git] / Koha / Middleware / UserEnv.pm
1 package Koha::Middleware::UserEnv;
2 use Modern::Perl;
3
4 use parent qw(Plack::Middleware);
5
6 use C4::Context;
7
8 =head1 NAME
9
10 Koha::Middleware::UserEnv - Middleware to ensure fresh userenv in all requests
11
12 =head1 METHODS
13
14 =head2 call
15
16 This method is called for each request, and will unset the userenv to avoid contamination between requests.
17
18 =cut
19
20 sub call {
21     my ( $self, $env ) = @_;
22
23     my $req = Plack::Request->new($env);
24
25     C4::Context->_unset_userenv;
26
27     return $self->app->($env);
28 }
29
30 1;