• Keeper.pm

    254 255  
    44 44 status => $res->status,
    45 45 ltime => time,
    46 46 );
    47 my ($type_prop) = grep { $_->{attr} eq 'type' } $res->structure;
    48 $data{type} = $res->type if $type_prop;
    47 49 $self->store_value ( %data );
    48 50 }
    49 51 return $self->get_session();
     
    82 84 }
    83 85
    84 86
    87 sub autologon {
    88 my $self = shift;
    89 my %opts = @_;
    90
    91 my $profile = delete $opts{profile};
    92 if ( ref $profile ) {
    93 my %data = (
    94 id => $profile->id,
    95 name => $profile->name,
    96 email => $profile->email,
    97 login => $profile->login,
    98 status => $profile->status,
    99 ltime => time,
    100 );
    101 my ($type_prop) = grep { $_->{attr} eq 'type' } $profile->structure;
    102 $data{type} = $profile->type if $type_prop;
    103 my ($ava_prop) = grep { $_->{attr} eq 'avatar' } $profile->structure;
    104 if ( $ava_prop ) {
    105 my $avatar = $profile->get_image('avatar');
    106 $data{avatar} = $avatar->{mini}{filename} if ref $avatar && exists $avatar->{filename};
    107 }
    108 $self->store_value ( %data );
    109 return $self->get_session();
    110 }
    111 return undef;
    112 }
    113
    114
    85 115 sub get_value {
    86 116
    87 117 my ($self, $name) = @_;
     
    211 241 tie %session, 'Apache::Session::Memcached', $sid, {
    212 242 Handler => $keeper->{session}->MEMD,
    213 243 Expiration => $state->{session}->{lifetime},
    214 # Servers => $state->{session}->memcached_servers,
    215 # NoRehash => 1,
    216 # Readonly => 0,
    217 # Debug => $DEBUG,
    218 # CompressThreshold => 10_000
    219 244 };
    220 245 };
    221 246 } else {
     
    249 274 tie %session, 'Apache::Session::Memcached', undef, {
    250 275 Handler => $keeper->{session}->MEMD,
    251 276 Expiration => $state->{session}->{lifetime},
    252 # Servers => $state->{session}->memcached_servers,
    253 # NoRehash => 1,
    254 # Readonly => 0,
    255 # Debug => $DEBUG,
    256 # CompressThreshold => 10_000
    257 277 };
    258 278 };
    259 279 } else {
    260 280 eval {
    261 281 tie %session, 'Apache::Session::File', undef, {
    262 Directory => $state->session->session_dir,
    282 Directory => $state->{session}->session_dir,
    263 283 };
    264 284 };
    265 285 }