This file is indexed.

/usr/share/perl5/Plack/Session.pm is in libplack-middleware-session-perl 0.21-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
package Plack::Session;
use strict;
use warnings;

our $VERSION   = '0.21';
our $AUTHORITY = 'cpan:STEVAN';

use Plack::Util::Accessor qw( session options );

sub new {
    my ($class, $env) = @_;
    bless {
        session => $env->{'psgix.session'},
        options => $env->{'psgix.session.options'},
    }, $class;
}

sub id {
    my $self = shift;
    $self->options->{id};
}

## Data Managment

sub dump {
    my $self = shift;
    $self->session;
}

sub get {
    my ($self, $key) = @_;
    $self->session->{$key};
}

sub set {
    my ($self, $key, $value) = @_;
    delete $self->options->{no_store};
    $self->session->{$key} = $value;
}

sub remove {
    my ($self, $key) = @_;
    delete $self->options->{no_store};
    delete $self->session->{$key};
}

sub keys {
    my $self = shift;
    keys %{$self->session};
}

## Lifecycle Management

sub expire {
    my $self = shift;
    for my $key ($self->keys) {
        delete $self->session->{$key};
    }
    $self->options->{expire} = 1;
}

1;

__END__

=pod

=head1 NAME

Plack::Session - Middleware for session management

=head1 SYNOPSIS

  # Use with Middleware::Session
  enable "Session";

  # later in your app
  use Plack::Session;
  my $app = sub {
      my $env = shift;
      my $session = Plack::Session->new($env);

      $session->id;
      $session->get($key);
      $session->set($key, $value);
      $session->remove($key);
      $session->keys;

      $session->expire;
  };

=head1 DESCRIPTION

This is the core session object, you probably want to look
at L<Plack::Middleware::Session>, unless you are writing your
own session middleware component.

=head1 METHODS

=over 4

=item B<new ( $env )>

The constructor takes a PSGI request env hash reference.

=item B<id>

This is the accessor for the session id.

=back

=head2 Session Data Management

These methods allows you to read and write the session data like
Perl's normal hash.

=over 4

=item B<get ( $key )>

=item B<set ( $key, $value )>

=item B<remove ( $key )>

=item B<keys>

=item B<session>, B<dump>

=back

=head2 Session Lifecycle Management

=over 4

=item B<expire>

This method can be called to expire the current session id.

=back

=head1 BUGS

All complex software has bugs lurking in it, and this module is no
exception. If you find a bug please either email me, or add the bug
to cpan-RT.

=head1 AUTHOR

Stevan Little E<lt>stevan.little@iinteractive.comE<gt>

=head1 COPYRIGHT AND LICENSE

Copyright 2009, 2010 Infinity Interactive, Inc.

L<http://www.iinteractive.com>

This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.

=cut