| 1 | =head1 NAME | ||||||||||
| 2 | |||||||||||
| 3 | OpenFrame::WebApp::Segment::Decline - abstract class for declining to process a | ||||||||||
| 4 | pipeline. | ||||||||||
| 5 | |||||||||||
| 6 | =head1 SYNOPSIS | ||||||||||
| 7 | |||||||||||
| 8 | # abstract class - cannot be used directly | ||||||||||
| 9 | |||||||||||
| 10 | use Pipeline; | ||||||||||
| 11 | use OpenFrame::WebApp::Segment::Decline::Something; | ||||||||||
| 12 | |||||||||||
| 13 | my $sub_pipe = new Pipeline; | ||||||||||
| 14 | |||||||||||
| 15 | my $decliner = new OpenFrame::WebApp::Segment::Decline::Something; | ||||||||||
| 16 | $sub_pipe->add_segment( $decliner, ... ); | ||||||||||
| 17 | |||||||||||
| 18 | my $pipe = new Pipeline; | ||||||||||
| 19 | $pipe->add_segment( ..., $sub_pipe, ... ); | ||||||||||
| 20 | |||||||||||
| 21 | ... | ||||||||||
| 22 | |||||||||||
| 23 | $pipe->dispatch; | ||||||||||
| 24 | |||||||||||
| 25 | # sub_pipe will not be executed if Decline::Something's | ||||||||||
| 26 | # should_decline is true. | ||||||||||
| 27 | |||||||||||
| 28 | =cut | ||||||||||
| 29 | |||||||||||
| 30 | package OpenFrame::WebApp::Segment::Decline; | ||||||||||
| 31 | |||||||||||
| 32 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 33 | 1 | ▶ | use warnings::register; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 34 | |||||||||||
| 35 | 1 | ▶ | use Pipeline::Production; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 36 | 1 | ▶ | use OpenFrame::WebApp::Error::Abstract; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 37 | |||||||||||
| 38 | 1 | our $VERSION = (split(/ /, '$Revision: 1.2 $'))[1]; | |||||||||
| 39 | |||||||||||
| 40 | 1 | ▶ | use base qw( Pipeline::Segment ); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 41 | |||||||||||
| 42 | 1 | ▶ | use constant message => 'declined'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 43 | |||||||||||
| 44 | 10 | ▶ | sub dispatch { | ||||||||
|
Subroutine
dispatch: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||
| 45 | 10 | my $self = shift; | |||||||||
| 46 | 10 | ▶ | if ($self->should_decline) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 47 | 5 | return new Pipeline::Production()->contents($self->message); | |||||||||
| 48 | } | ||||||||||
| 49 | } | ||||||||||
| 50 | |||||||||||
| 51 | 0 | ▶ | sub should_decline { | ||||||||
|
Subroutine
should_decline: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 52 | 0 | my $self = shift; | |||||||||
| 53 | 0 | throw OpenFrame::WebApp::Error::Abstract( class => ref($self) ); | |||||||||
| 54 | } | ||||||||||
| 55 | |||||||||||
| 56 | |||||||||||
| 57 | 1 | 1; | |||||||||
| 58 | |||||||||||
| 59 | __END__ | ||||||||||