107 lines
2.7 KiB
Perl
107 lines
2.7 KiB
Perl
# ==================================================================
|
|
# Gossamer Threads Module Library - http://gossamer-threads.com/
|
|
#
|
|
# GT::CGI::Action::Plugin
|
|
# Author: Scott Beck
|
|
# CVS Info :
|
|
# $Id: Plugin.pm,v 1.5 2004/01/13 01:35:16 jagerman Exp $
|
|
#
|
|
# Copyright (c) 2004 Gossamer Threads Inc. All Rights Reserved.
|
|
# ==================================================================
|
|
#
|
|
# Description:
|
|
#
|
|
|
|
package GT::CGI::Action::Plugin;
|
|
# ==================================================================
|
|
|
|
use vars qw/@ISA @EXPORT/;
|
|
use strict;
|
|
|
|
use GT::CGI::Action::Common;
|
|
|
|
use Carp;
|
|
|
|
@ISA = qw(GT::CGI::Action::Common);
|
|
@EXPORT = qw(ACT_ERROR ACT_OK ACT_EXIT);
|
|
|
|
sub return {
|
|
# ----------------------------------------------------------------------------
|
|
my $self = shift;
|
|
if (@_) {
|
|
$self->{return} = shift;
|
|
croak "Unknown arguments: @_" if @_;
|
|
}
|
|
return $self->{return};
|
|
}
|
|
|
|
sub info {
|
|
# ----------------------------------------------------------------------------
|
|
my $self = shift;
|
|
$self->SUPER::info(@_) if @_;
|
|
$self->return(ACT_OK);
|
|
}
|
|
|
|
sub print_info {
|
|
# ----------------------------------------------------------------------------
|
|
my $self = shift;
|
|
$self->SUPER::print_info(@_);
|
|
$self->return(ACT_EXIT);
|
|
}
|
|
|
|
sub error {
|
|
# ----------------------------------------------------------------------------
|
|
my $self = shift;
|
|
$self->SUPER::error(@_) if @_;
|
|
$self->return(ACT_ERROR);
|
|
}
|
|
|
|
sub print_error {
|
|
# ----------------------------------------------------------------------------
|
|
my $self = shift;
|
|
$self->SUPER::print_error(@_);
|
|
$self->return(ACT_ERROR);
|
|
}
|
|
|
|
sub exit {
|
|
# ----------------------------------------------------------------------------
|
|
my $self = shift;
|
|
$self->return(ACT_EXIT);
|
|
}
|
|
|
|
sub error_page {
|
|
# ----------------------------------------------------------------------------
|
|
my $self = shift;
|
|
if (@_) {
|
|
$self->{error_page} = shift;
|
|
croak "Unknown arguments: @_" if @_;
|
|
}
|
|
if (defined $self->{error_page}) {
|
|
return $self->{error_page};
|
|
}
|
|
croak "No action was ever specified" unless defined $self->action;
|
|
return $self->{config}{actions}{$self->action}[ACT_ERROR_PAGE];
|
|
|
|
}
|
|
|
|
sub success_page {
|
|
# ----------------------------------------------------------------------------
|
|
my $self = shift;
|
|
if (@_) {
|
|
$self->{success_page} = shift;
|
|
croak "Unknown arguments: @_" if @_;
|
|
}
|
|
if (defined $self->{success_page}) {
|
|
return $self->{success_page};
|
|
}
|
|
croak "No action was ever specified" unless defined $self->action;
|
|
return $self->{config}{actions}{$self->action}[ACT_SUCCESS_PAGE];
|
|
}
|
|
|
|
|
|
1;
|
|
|
|
__END__
|
|
|
|
|