Index: Keeper.pm =================================================================== --- Keeper.pm (revision 271) +++ Keeper.pm (revision 272) @@ -190,7 +190,8 @@ } untie %$session; - return \%ret; + my $session_object = session::Session->new( %ret ); + return $session_object; } @@ -306,4 +307,27 @@ } +sub _get_hash_from_profile { + my $profile = shift; + return unless ref $profile; + + my %data = ( + id => $profile->id, + name => $profile->name, + email => $profile->email, + login => $profile->login, + status => $profile->status, + ltime => time, + ); + my ($type_prop) = grep { $_->{attr} eq 'type' } $profile->structure; + $data{type} = $profile->type if $type_prop; + my ($ava_prop) = grep { $_->{attr} eq 'avatar' } $profile->structure; + if ( $ava_prop ) { + my $avatar = $profile->get_image('avatar'); + $data{avatar} = $avatar->{mini}{filename} if ref $avatar && exists $avatar->{filename}; + } + + return %data; +} + 1;