File Coverage

blib/lib/CGI/Session/Driver/bitbucket.pm
Criterion Covered Total %
statement 23 31 74.1
branch 3 10 30.0
condition n/a
subroutine 7 9 77.7
pod 4 4 100.0
total 37 54 68.5


line stmt bran cond sub pod time code
1             package CGI::Session::Driver::bitbucket;
2              
3 1     1   9594 use Carp;
  1         2  
  1         78  
4 1     1   874 use CGI::Session::Driver;
  1         528  
  1         30  
5 1     1   20 use strict;
  1         3  
  1         28  
6 1     1   6 use warnings;
  1         2  
  1         417  
7             @CGI::Session::Driver::bitbucket::ISA = qw( CGI::Session::Driver );
8             $CGI::Session::Driver::bitbucket::VERSION = "1.06";
9              
10             =pod
11              
12             =head1 NAME
13              
14             CGI::Session::Driver::bitbucket - a module that loses your session data
15              
16             =head1 SYNOPSIS
17            
18             use CGI::Session;
19             my $session = new CGI::Session("driver:bitbucket", $sid, {Log=>1});
20            
21             For more options and examples, read the rest of this document and
22             consult L.
23              
24             =head1 DESCRIPTION
25              
26             bitbucket is a CGI::Session driver to let you add session
27             support to your program and not have to worry about where it will be
28             stored until you're ready for that part.
29              
30             You can use the Log=>1 argument to see warnings in your log when the
31             session would have stored, retrieved, and trashed data.
32              
33             To write your own drivers for B, refer to L.
34              
35             =head1 STORAGE
36              
37             This driver does not store any data. This means whenever you load a session using
38             bitbucket, your session will always be blank.
39              
40             =head1 OPTIONS
41              
42             =head2 Log => 1
43              
44             Turn this on to see messages in your log about the data you would have saved
45             if you were using something other than the bit bucket for storage.
46              
47             =head1 METHODS
48              
49             =cut
50              
51             ########################
52             # Driver methods follow
53             ########################
54              
55             =head2 store
56              
57             The null session does not store data. This method always returns 1.
58              
59             =cut
60              
61             sub store {
62 1     1 1 86711 my ($self, $sid, $data) = @_;
63 1 50       13 if( $self->{Log} ) {
64 1         256 carp "bitbucket->store($sid,$data)";
65             }
66 1         177 return 1;
67             }
68              
69             =head2 retrieve
70              
71             The null session does not retrieve data. This method always returns 0.
72              
73             =cut
74              
75             sub retrieve {
76 0     0 1 0 my ($self, $sid) = @_;
77 0 0       0 if( $self->{Log} ) {
78 0         0 carp "bitbucket->retrieve($sid)";
79             }
80 0         0 return 0;
81             }
82              
83             =head2 remove
84              
85             Since the null session does not store data, this method does nothing and
86             always returns 1.
87              
88             =cut
89              
90             sub remove {
91 1     1 1 936 my ($self, $sid) = @_;
92 1 50       6 if( $self->{Log} ) {
93 1         144 carp "bitbucket->remove($sid)";
94             }
95 1         8348 return 1;
96             }
97              
98             =head2 traverse
99              
100             Does nothing and always returns 1.
101              
102             =cut
103              
104             sub traverse {
105 0     0 1 0 my ($self, $coderef) = @_;
106 0 0       0 if( $self->{Log} ) {
107 0         0 carp "bitbucket->traverse(@_)";
108             }
109 0         0 return 1;
110             }
111              
112              
113             # called before object is terminated
114             sub DESTROY {
115 1     1   54 my $self = shift;
116 1 50       8 if( $self->{Log} ) {
117 1         200 carp "bitbucket->delete()";
118             }
119             }
120              
121              
122             1;
123              
124             =head1 COPYRIGHT
125              
126             CGI::Session::Driver::bitbucket is Copyright (C) 2005-2008 Jonathan Buhacoff. All rights reserved.
127              
128             =head1 LICENSE
129              
130             This library is free software and can be modified and distributed under the same
131             terms as Perl itself.
132              
133              
134             =head1 AUTHOR
135              
136             Jonathan Buhacoff wrote CGI::Session::Driver::bitbucket
137              
138             =head1 SEE ALSO
139              
140             =over 4
141              
142             =item *
143              
144             L - CGI::Session manual
145              
146             =item *
147              
148             L - extended CGI::Session manual
149              
150             =item *
151              
152             L - practical solutions for real life problems
153              
154             =item *
155              
156             B - "HTTP State Management Mechanism" found at ftp://ftp.isi.edu/in-notes/rfc2965.txt
157              
158             =item *
159              
160             L - standard CGI library
161              
162             =item *
163              
164             L - an alternative to CGI::Session
165              
166             =back
167              
168             =cut