OpenFrame::WebApp::Segment::Decline - abstract class for declining to process a


OpenFrame-WebApp documentation Contained in the OpenFrame-WebApp distribution.

Index


Code Index:

NAME

Top

OpenFrame::WebApp::Segment::Decline - abstract class for declining to process a pipeline.

SYNOPSIS

Top

  # abstract class - cannot be used directly

  use Pipeline;
  use OpenFrame::WebApp::Segment::Decline::Something;

  my $sub_pipe = new Pipeline;

  my $decliner = new OpenFrame::WebApp::Segment::Decline::Something;
  $sub_pipe->add_segment( $decliner, ... );

  my $pipe = new Pipeline;
  $pipe->add_segment( ..., $sub_pipe, ... );

  ...

  $pipe->dispatch;

  # sub_pipe will not be executed if Decline::Something's
  # should_decline is true.

DESCRIPTION

Top

The OpenFrame::WebApp::Segment::User class provides a standard way of declining to continue processing a Pipeline.

This class inherits its interface from Pipeline::Segment.

METHODS

Top

$production = $obj->dispatch

Returns a Pipeline::Production with $self->message if $self->should_decline is true.

$boolean = $obj->should_decline

abstract method.

$msg = $obj->message

message to decline with. defaults to 'declined'.

AUTHOR

Top

Steve Purkis <spurkis@epn.nu>

COPYRIGHT

Top

SEE ALSO

Top

Pipeline::Segment


OpenFrame-WebApp documentation Contained in the OpenFrame-WebApp distribution.
package OpenFrame::WebApp::Segment::Decline;

use strict;
use warnings::register;

use Pipeline::Production;
use OpenFrame::WebApp::Error::Abstract;

our $VERSION = (split(/ /, '$Revision: 1.2 $'))[1];

use base qw( Pipeline::Segment );

use constant message => 'declined';

sub dispatch {
    my $self = shift;
    if ($self->should_decline) {
	return new Pipeline::Production()->contents($self->message);
    }
}

sub should_decline {
    my $self = shift;
    throw OpenFrame::WebApp::Error::Abstract( class => ref($self) );
}


1;

__END__