| 1 | # -*- Mode: perl -*- | ||
| 2 | # | ||
| 3 | # $Id: Bounce.pm,v 0.1.1.1 2001/05/30 21:13:41 ram Exp $ | ||
| 4 | # | ||
| 5 | # Copyright (c) 1998-2001, Raphael Manfredi | ||
| 6 | # Copyright (c) 2000-2001, Christophe Dehaudt | ||
| 7 | # | ||
| 8 | # You may redistribute only under the terms of the Artistic License, | ||
| 9 | # as specified in the README file that comes with the distribution. | ||
| 10 | # | ||
| 11 | # HISTORY | ||
| 12 | # $Log: Bounce.pm,v $ | ||
| 13 | # Revision 0.1.1.1 2001/05/30 21:13:41 ram | ||
| 14 | # patch1: removed DFEATURE call from stringify hook | ||
| 15 | # | ||
| 16 | # Revision 0.1 2001/04/22 17:57:03 ram | ||
| 17 | # Baseline for first Alpha release. | ||
| 18 | # | ||
| 19 | # $EndLog$ | ||
| 20 | # | ||
| 21 | |||
| 22 | use strict; | ||
| 23 | |||
| 24 | package CGI::MxScreen::Exception::Bounce; | ||
| 25 | |||
| 26 | require CGI::MxScreen::Exception; | ||
| 27 | use vars qw(@ISA); | ||
| 28 | @ISA = qw(CGI::MxScreen::Exception); | ||
| 29 | |||
| 30 | use Carp::Datum; | ||
| 31 | use Log::Agent; | ||
| 32 | |||
| 33 | use overload | ||
| 34 | qw("" stringify); | ||
| 35 | |||
| 36 | use constant TARGET => 0; | ||
| 37 | |||
| 38 | # | ||
| 39 | # ->make -- defined | ||
| 40 | # | ||
| 41 | # Creation routine. | ||
| 42 | # | ||
| 43 | # Contains the state and args definition as a blessed ARRAY, indicating to | ||
| 44 | # the manager where to "bounce". | ||
| 45 | # | ||
| 46 | sub make { | ||
| 47 | DFEATURE my $f_; | ||
| 48 | my $self = bless [], shift; | ||
| 49 | my ($target) = @_; | ||
| 50 | |||
| 51 | VERIFY ref $target eq 'ARRAY', "target given as [state, args...]"; | ||
| 52 | |||
| 53 | $self->[TARGET] = $target; | ||
| 54 | |||
| 55 | return DVAL $self; | ||
| 56 | } | ||
| 57 | |||
| 58 | sub target { $_[0]->[TARGET] } | ||
| 59 | |||
| 60 | # | ||
| 61 | # ->stringify -- redefined | ||
| 62 | # | ||
| 63 | # For display purposes, if they try to stringify us. | ||
| 64 | # | ||
| 65 | sub stringify { | ||
| 66 | # Can't DFEATURE this routine, or would be a recursive call | ||
| 67 | my $self = shift; | ||
| 68 | my ($state, @args) = @{$self->target}; | ||
| 69 | my $state_str = $state; | ||
| 70 | $state_str .= "(" . join(', ', @args) . ")" if @args; | ||
| 71 | return "bounce exception => $state_str"; | ||
| 72 | } | ||
| 73 | |||
| 74 | 1; | ||
| 75 | |||
| 76 | =head1 NAME | ||
| 77 | |||
| 78 | CGI::MxScreen::Exception::Bounce - State bouncing exception | ||
| 79 | |||
| 80 | =head1 SYNOPSIS | ||
| 81 | |||
| 82 | # Not meant to be used directly | ||
| 83 | |||
| 84 | =head1 DESCRIPTION | ||
| 85 | |||
| 86 | This class models a state bouncing exception, generated by calling the | ||
| 87 | C<bounce()> routine on screens. It is used internally by C<CGI::MxScreen>. | ||
| 88 | |||
| 89 | =head1 AUTHORS | ||
| 90 | |||
| 91 | The original authors are | ||
| 92 | Raphael Manfredi F<E<lt>Raphael_Manfredi@pobox.comE<gt>> | ||
| 93 | and | ||
| 94 | Christophe Dehaudt F<E<lt>Christophe.Dehaudt@teamlog.frE<gt>>. | ||
| 95 | |||
| 96 | Send bug reports, suggestions, problems or questions to | ||
| 97 | Jason Purdy F<E<lt>Jason@Purdy.INFOE<gt>> | ||
| 98 | |||
| 99 | =head1 SEE ALSO | ||
| 100 | |||
| 101 | CGI::MxScreen::Screen(3). | ||
| 102 | |||
| 103 | =cut | ||
| 104 |