"Fossies" - the Fresh Open Source Software Archive

Member "Apache-Session-1.93/lib/Apache/Session/Generate/ModUniqueId.pm" (15 Sep 2009, 1380 Bytes) of package /linux/www/Apache-Session-1.93.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Perl source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "ModUniqueId.pm" see the Fossies "Dox" file reference documentation.

    1 package Apache::Session::Generate::ModUniqueId;
    2 
    3 use strict;
    4 use vars qw($VERSION);
    5 $VERSION = '0.02';
    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