blib/lib/CGI/Session/Driver/bitbucket.pm

filter: Statementstmt 76.4% 26 / 34 Branchbran 30.0% 3 / 10 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 77.7% 7 / 9 Podpod 100% 4 / 4 totaltotal 70.1% 40 / 57 CC 6 SCAR 10.5
CC
6
Cov
66%
retrieve
6.0
traverse
6.0
DESTROY
2.0
CRAP 2.9
↑ Summary
1 package CGI::Session::Driver::bitbucket;
2  
3 2 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use CGI::Session::Driver;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 2 @CGI::Session::Driver::bitbucket::ISA = qw( CGI::Session::Driver );
8 2 $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<CGI::Session>.
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<CGI::Session>, refer to L<CGI::Session>.
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 1 ▶sub store {
Subroutine store: called CC=2 SCAR=7.0
Pod documented
62 1 my ($self, $sid, $data) = @_;
63 1 ▶ if( $self->{Log} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"Log"}) 1 0 1
64 1 carp "bitbucket->store($sid,$data)";
65 }
66 1 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 0 ▶sub retrieve {
Subroutine retrieve: not called CC=2 SCAR=17.9
Pod documented
76 0 my ($self, $sid) = @_;
77 0 ▶ if( $self->{Log} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"Log"}) 0 0 0
78 0 carp "bitbucket->retrieve($sid)";
79 }
80 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 1 ▶sub remove {
Subroutine remove: called CC=2 SCAR=7.0
Pod documented
91 1 my ($self, $sid) = @_;
92 1 ▶ if( $self->{Log} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"Log"}) 1 0 1
93 1 carp "bitbucket->remove($sid)";
94 }
95 1 return 1;
96 }
97  
98 =head2 traverse
99  
100 Does nothing and always returns 1.
101  
102 =cut
103  
104 0 ▶sub traverse {
Subroutine traverse: not called CC=2 SCAR=17.9
Pod documented
105 0 my ($self, $coderef) = @_;
106 0 ▶ if( $self->{Log} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"Log"}) 0 0 0
107 0 carp "bitbucket->traverse(@_)";
108 }
109 0 return 1;
110 }
111  
112  
113 # called before object is terminated
114 1 ▶sub DESTROY {
Subroutine DESTROY: called CC=2 SCAR=7.1
115 1 my $self = shift;
116 1 ▶ if( $self->{Log} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"Log"}) 1 0 1
117 1 carp "bitbucket->delete()";
118 }
119 }
120  
121  
122 2 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 <jonathan@pnc.net> wrote CGI::Session::Driver::bitbucket
137  
138 =head1 SEE ALSO
139  
140 =over 4
141  
142 =item *
143  
144 L<CGI::Session|CGI::Session> - CGI::Session manual
145  
146 =item *
147  
148 L<CGI::Session::Tutorial|CGI::Session::Tutorial> - extended CGI::Session manual
149  
150 =item *
151  
152 L<CGI::Session::CookBook|CGI::Session::CookBook> - practical solutions for real life problems
153  
154 =item *
155  
156 B<RFC 2965> - "HTTP State Management Mechanism" found at ftp://ftp.isi.edu/in-notes/rfc2965.txt
157  
158 =item *
159  
160 L<CGI|CGI> - standard CGI library
161  
162 =item *
163  
164 L<Apache::Session|Apache::Session> - an alternative to CGI::Session
165  
166 =back
167  
168 =cut
↑ Summary