root/Apache-Session-Generate-ModUniqueId/trunk/lib/Apache/Session/Generate/ModUniqueId.pm

Revision 288 (checked in by miyagawa, 19 years ago)

Initial revision

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1 package Apache::Session::Generate::ModUniqueId;
2
3 use strict;
4 use vars qw($VERSION);
5 $VERSION = '0.01';
6
7 sub generate {
8     my $session = shift;
9     unless (exists $ENV{UNIQUE_ID}) {
10         require Carp;
11         Carp::croak 'Can\'t get UNIQUE_ID env variable. Make sure mod_unique_id is enabled.';
12     }
13     $session->{data}->{_session_id} = $ENV{UNIQUE_ID};
14 }
15
16 sub validate {
17     my $session = shift;
18     $session->{data}->{_session_id} =~ /^[A-Za-z0-9@\-]+$/
19         or die "invalid session id: $session->{data}->{_session_id}.";
20 }
21
22 1;
23 __END__
24
25 =head1 NAME
26
27 Apache::Session::Generate::ModUniqueId - mod_unique_id for session ID generation
28
29 =head1 SYNOPSIS
30
31   use Apache::Session::Flex;
32
33   tie %session, 'Apache::Session::Flex', $id, {
34        Store     => 'MySQL',
35        Lock      => 'Null',
36        Generate  => 'ModUniqueId',
37        Serialize => 'Storable',
38   };
39
40 =head1 DESCRIPTION
41
42 Apache::Session::Generate::ModUniqueId enables you to use unique id
43 generated by mod_unique_id as session id for Apache::Session
44 framework. Using mod_unique_id would ensure higher level uniquess of
45 id.
46
47 =head1 AUTHOR
48
49 Tatsuhiko Miyagawa <miyagawa@bulknews.net>
50
51 This library is free software; you can redistribute it and/or modify
52 it under the same terms as Perl itself.
53
54 =head1 SEE ALSO
55
56 L<Apache::Session>, L<Apache::Session::Flex>, mod_unique_id
57
58 =cut
Note: See TracBrowser for help on using the browser.