| 1 | =head1 NAME | ||||||||||
| 2 | |||||||||||
| 3 | OpenFrame::WebApp::Segment::User - abstract class for getting Users | ||||||||||
| 4 | from the store. | ||||||||||
| 5 | |||||||||||
| 6 | =head1 SYNOPSIS | ||||||||||
| 7 | |||||||||||
| 8 | # abstract class - cannot be used directly | ||||||||||
| 9 | |||||||||||
| 10 | use base qw( OpenFrame::WebApp::Segment::User ); | ||||||||||
| 11 | |||||||||||
| 12 | sub dispatch { | ||||||||||
| 13 | ... | ||||||||||
| 14 | my $user $self->get_user_from_store; | ||||||||||
| 15 | ... | ||||||||||
| 16 | } | ||||||||||
| 17 | |||||||||||
| 18 | =cut | ||||||||||
| 19 | |||||||||||
| 20 | package OpenFrame::WebApp::Segment::User; | ||||||||||
| 21 | |||||||||||
| 22 | 3 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 23 | 3 | ▶ | use warnings::register; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 24 | |||||||||||
| 25 | 3 | ▶ | use OpenFrame::WebApp::User; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 26 | 3 | ▶ | use OpenFrame::WebApp::Error::Abstract; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 27 | |||||||||||
| 28 | 3 | our $VERSION = (split(/ /, '$Revision: 1.2 $'))[1]; | |||||||||
| 29 | |||||||||||
| 30 | 3 | ▶ | use base qw( Pipeline::Segment ); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 31 | |||||||||||
| 32 | ## try various methods to find a user in the store | ||||||||||
| 33 | 5 | ▶ | sub get_user_from_store { | ||||||||
|
Subroutine
get_user_from_store: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||
| 34 | 5 | my $self = shift; | |||||||||
| 35 | 5 | my $user; | |||||||||
| 36 | |||||||||||
| 37 | 5 | ▶ | if ($self->store->isa( 'Pipeline::Store::ISA' )) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 38 | 1 | $user = $self->store->get('OpenFrame::WebApp::User'); | |||||||||
| 39 | } else { | ||||||||||
| 40 | 4 | foreach my $class (values %{ OpenFrame::WebApp::User->types }) { | |||||||||
| 41 | 5 | ▶ | last if( $user = $self->store->get($class) ); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 42 | } | ||||||||||
| 43 | } | ||||||||||
| 44 | |||||||||||
| 45 | 5 | return $user; | |||||||||
| 46 | } | ||||||||||
| 47 | |||||||||||
| 48 | 3 | 1; | |||||||||
| 49 | |||||||||||
| 50 | __END__ | ||||||||||