Public feed #726446

Mine

public text v1 · immutable
Raw Edit
·published 2007-10-05 06:28 UTC
rendered paste body
package MasSess;

use CGI;
use CGI::Session;

# Create MASSID cookie with session id
# Cookie expire in 1 hour
# Session file will be saved in /tmp

sub new {
        my $type = shift;
        my $self = {};

        my $cgi=new CGI;
        my $sid=$cgi->cookie("MASSID") || undef;
        $self->{'session'}=new CGI::Session(undef,$sid,{Directory=>'/tmp'});
        my $cookie=$cgi->cookie(MASSID => $self->{session}->id);
        print $cgi->header(-cookie=>$cookie);
        $self->{session}->expire('+1h');

        bless $self, $type;
        return $self;
}

sub clear() {
        my $self = shift;
        return $self->{session}->clear(@_);
}

sub param() {
        my $self = shift;
        return $self->{session}->param(@_);
}

sub delete {
        my $self = shift;
        $self->{session}->delete();
}

return 1;