CGI::Session::BitBucket - a module that loses your session data


CGI-Session-BitBucket documentation Contained in the CGI-Session-BitBucket distribution.

Index


Code Index:

NAME

Top

CGI::Session::BitBucket - a module that loses your session data

SYNOPSIS

Top

    use CGI::Session;
    my $session = new CGI::Session("driver:BitBucket", $sid, {Log=>1});

For more options and examples, read the rest of this document and consult CGI::Session.

DESCRIPTION

Top

CGI::Session::BitBucket is a CGI::Session driver to let you add session support to your program and not have to worry about where it will be stored until you're ready for that part.

You can use the Log=>1 argument to see warnings in your log when the session would have stored, retrieved, and trashed data.

To write your own drivers for CGI::Session, refer to CGI::Session.

STORAGE

Top

This driver does not store any data. This means whenever you load a session using BitBucket, your session will always be blank.

OPTIONS

Top

Log => 1

Turn this on to see messages in your log about the data you would have saved if you were using something other than the bit bucket for storage.

COPYRIGHT

Top

LICENSE

Top

This library is free software and can be modified and distributed under the same terms as Perl itself.

AUTHOR

Top

Jonathan Buhacoff <jonathan@buhacoff.net> wrote CGI::Session::BitBucket

SEE ALSO

Top


CGI-Session-BitBucket documentation Contained in the CGI-Session-BitBucket distribution.

package CGI::Session::BitBucket;

use Carp;
use CGI::Session;
use CGI::Session::ID::MD5;
use base qw(
    CGI::Session
    CGI::Session::ID::MD5
    CGI::Session::Serialize::Default
);
use strict;
use warnings;
use vars qw($VERSION);
($VERSION) = '1.2';

########################
# Driver methods follow
########################


# the null session does not store data
sub store {
    my ($self, $sid, $options, $data) = @_;   

	my $args = $options->[1] || {};  # or $self->driver_options (new CGI::Session method)

	if( $args->{Log} ) {
		carp "CGI::Session::BitBucket->store($sid) ".$self->freeze($data);
	}
    
    return 1;
}



# the null session does not retrieve data
sub retrieve {
    my ($self, $sid, $options) = @_;
    
	my $args = $options->[1] || {};  # or $self->driver_options (new CGI::Session method)

	if( $args->{Log} ) {
		carp "CGI::Session::BitBucket->retrieve($sid)";
	}
    
    return $self->thaw("");
}


# removes the given data and all the disk space associated with it
sub remove {
    my ($self, $sid, $options) = @_;

	my $args = $options->[1] || {};  # or $self->driver_options (new CGI::Session method)

	if( $args->{Log} ) {
		carp "CGI::Session::BitBucket->remove($sid)";
	}
    
    
    return 1;    
}


# called right before the object is destroyed to do cleanup
sub teardown {
    my ($self, $sid, $options) = @_;

	my $args = $options->[1] || {};  # or $self->driver_options (new CGI::Session method)

	if( $args->{Log} ) {
		carp "CGI::Session::BitBucket->teardown($sid)";
	}
    

    return 1;
}




1;