| 1 | =head1 NAME | ||||||||||
| 2 | |||||||||||
| 3 | OpenFrame::WebApp::Segment::Template - abstract class for getting Templates | ||||||||||
| 4 | from the store. | ||||||||||
| 5 | |||||||||||
| 6 | =head1 SYNOPSIS | ||||||||||
| 7 | |||||||||||
| 8 | # abstract class - cannot be used directly | ||||||||||
| 9 | |||||||||||
| 10 | use base qw( OpenFrame::WebApp::Segment::Template ); | ||||||||||
| 11 | |||||||||||
| 12 | sub dispatch { | ||||||||||
| 13 | ... | ||||||||||
| 14 | my $template $self->get_template_from_store; | ||||||||||
| 15 | ... | ||||||||||
| 16 | } | ||||||||||
| 17 | |||||||||||
| 18 | =cut | ||||||||||
| 19 | |||||||||||
| 20 | package OpenFrame::WebApp::Segment::Template; | ||||||||||
| 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::Template; | ||||||||
|
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 template in the store | ||||||||||
| 33 | 6 | ▶ | sub get_template_from_store { | ||||||||
|
Subroutine
get_template_from_store: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||
| 34 | 6 | my $self = shift; | |||||||||
| 35 | 6 | my $template; | |||||||||
| 36 | |||||||||||
| 37 | 6 | ▶ | if ($self->store->isa( 'Pipeline::Store::ISA' )) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 38 | 1 | $template = $self->store->get('OpenFrame::WebApp::Template'); | |||||||||
| 39 | } else { | ||||||||||
| 40 | 5 | foreach my $class (values %{ OpenFrame::WebApp::Template->types }) { | |||||||||
| 41 | 12 | ▶ | last if( $template = $self->store->get($class) ); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 42 | } | ||||||||||
| 43 | } | ||||||||||
| 44 | |||||||||||
| 45 | 6 | return $template; | |||||||||
| 46 | } | ||||||||||
| 47 | |||||||||||
| 48 | 3 | 1; | |||||||||
| 49 | |||||||||||
| 50 | __END__ | ||||||||||