/usr/share/perl5/CGI/Session/Driver/chi.pm is in libcgi-session-driver-chi-perl 1.0.3-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 | package CGI::Session::Driver::chi;
=head1 NAME
CGI::Session::Driver::chi - This driver allows CGI::Session to use CHI as a session store
=cut
=head1 SYNOPSIS
$s = CGI::Session->new(
"driver:chi",
$sid, {
driver => 'File',
root_dir => '/path/to/root'
});
$s = CGI::Session->new(
"driver:chi",
$sid, {
chi_class => 'My::CHI',
namespace => 'cgi',
});
=head1 DESCRIPTION
This driver allows L<CGI::Session> to use L<CHI> as a session store
=cut
=head2 DRIVER ARGUMENTS
The init sub accepts a hash ref with the same arguments as would be passed to
L<CHI>, plus an additional argument, chi_class.
=cut
use strict;
use warnings;
use strict;
use CHI;
use base qw( CGI::Session::Driver CGI::Session::ErrorHandler );
our $VERSION = '1.0.3';
sub init {
my ($self) = @_;
my %args = %$self;
my $chi_class = delete $args{chi_class} || "CHI";
my $chi = $chi_class->new(%args);
$self->{CHI} = $chi;
return 1;
}
sub store {
my ($self, $sid, $datastr) = @_;
$self->{CHI}->set($sid, $datastr);
return 1;
}
sub retrieve {
my ($self, $sid) = @_;
my $value = $self->{CHI}->get($sid);
return 0 unless defined $value;
return $value;
}
sub remove {
my ($self, $sid) = @_;
$self->{CHI}->remove($sid);
return 1;
}
sub traverse {
my ($self, $coderef) = @_;
foreach my $key ($self->{CHI}->get_keys) {
$coderef->( $key )
}
return 1;
}
=head1 AUTHOR
James Rouzier. <rouzier@gmail.com>
=head1 COPYRIGHT
Copyright (C) 2013 James Rouzier
=head1 LICENSE
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
USA.
=cut
1;
|