WebApp/Segment/User/Session.pm

filter: Statementstmt 100% 20 / 20 Branchbran n/a Conditioncond 50.0% 2 / 4 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 5 / 5 Podpod 100% 2 / 2 totaltotal 87.8% 29 / 33 CC 3 SCAR 4.6
CC
3
Cov
92%
get_user_from_session
2.0
save_user_in_session
2.0
BEGIN
1.0
CRAP 1.6
« WebApp/Session/CacheBase.pm ↑ Summary WebApp/Segment/Session/Loader.pm »
1 =head1 NAME
2  
3 OpenFrame::WebApp::Segment::User::Session - abstract class for working with
4 users stored in sessions.
5  
6 =head1 SYNOPSIS
7  
8 # abstract - cannot be used directly
9  
10 # set session key:
11 $OpenFrame::WebApp::Segment::User::Session::USER_KEY = 'my_user';
12  
13 =cut
14  
15 package OpenFrame::WebApp::Segment::User::Session;
16  
17 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
18 2 ▶use warnings::register;
Subroutine BEGIN: called CC=1 SCAR=0.0
19  
20 2 ▶use base qw( OpenFrame::WebApp::Segment::Session );
Subroutine BEGIN: called CC=1 SCAR=0.0
21  
22 2 our $VERSION = (split(/ /, '$Revision: 1.1 $'))[1];
23 2 our $USER_KEY = 'user';
24  
25 1 ▶sub save_user_in_session {
Subroutine save_user_in_session: called CC=2 SCAR=7.0
Pod documented
26 1 my $self = shift;
27 1 my $user = shift;
28 1 ▶ my $session = $self->get_session_from_store || return;
Condition50%1/2
$self->get_session_from_store || (return)
l!l
10
MC/DC0%0/1
$self->get_session_from_store || (return)
$self->get_session_from_store
Truth table50%1/2
A
A= $self->get_session_from_store
Aresult
11
00
29 1 $session->set( $USER_KEY, $user );
30 1 return 1;
31 }
32  
33 1 ▶sub get_user_from_session {
Subroutine get_user_from_session: called CC=2 SCAR=7.1
Pod documented
34 1 my $self = shift;
35 1 ▶ my $session = $self->get_session_from_store || return;
Condition50%1/2
$self->get_session_from_store || (return)
l!l
10
MC/DC0%0/1
$self->get_session_from_store || (return)
$self->get_session_from_store
Truth table50%1/2
A
A= $self->get_session_from_store
Aresult
11
00
36 1 return $session->get( $USER_KEY );
37 }
38  
39  
40 2 1;
41  
42 __END__
« WebApp/Session/CacheBase.pm ↑ Summary WebApp/Segment/Session/Loader.pm »