Changeset 657

Show
Ignore:
Timestamp:
06/04/02 00:09:43
Author:
miyagawa
Message:

add create => 1 option

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • PHP-Session/trunk/Changes

    r573 r657  
    11Revision history for Perl extension PHP::Session 
     2 
     30.08  Tue Jun  4 00:08:40 JST 2002 
     4        * now this module can create session file, with { create => 1 } option 
    25 
    360.07  Sat Apr  6 17:44:38 JST 2002 
  • PHP-Session/trunk/lib/PHP/Session.pm

    r573 r657  
    33use strict; 
    44use vars qw($VERSION); 
    5 $VERSION = 0.07
     5$VERSION = 0.08
    66 
    77use vars qw(%SerialImpl); 
     
    2222        save_path         => '/tmp', 
    2323        serialize_handler => 'php', 
     24        create            => , 
    2425    ); 
    2526    $opt ||= {}; 
     
    100101    my $self = shift; 
    101102    my $cont = $self->_slurp_content; 
     103    if (!$cont && !$self->{create}) { 
     104        _croak("no session file for ", $self->id); 
     105    } 
    102106    $self->{_data} = $self->decode($cont); 
    103107} 
     
    117121sub _slurp_content { 
    118122    my $self = shift; 
    119     my $handle = FileHandle->new($self->_file_path) 
    120         or _croak("session file not found: $!"); 
     123    my $handle = FileHandle->new($self->_file_path) or return; 
    121124    local $/ = undef; 
    122125    return scalar <$handle>; 
     
    158161  $session->destroy; 
    159162 
     163  # create session file, if not existent 
     164  $session = PHP::Session->new($new_sid, { create => 1 }); 
     165 
    160166=head1 DESCRIPTION 
    161167