Skip Menu |

This queue is for tickets about the CGI-Application-Plugin-Forward CPAN distribution.

Report information
The Basics
Id: 26348
Status: new
Priority: 0/
Queue: CGI-Application-Plugin-Forward

People
Owner: Nobody in particular
Requestors: erwan [...] mas.nom.fr
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: (no value)
Fixed in:
  • 0.01
  • 1.00
  • 1.01
  • 1.03
  • 1.04
  • 1.05
  • 1.06



Subject: Add a method advance
It's a patch inspired by CGI::Application::Plugin::Redirect to implement a method advance . This method is similar to forward , because it take a 'runmode' as argument but it do a http redirect . And with this method , the programm can a little more concise .
Subject: CAP.F.advance.txt
--- /usr/share/perl5/CGI/Application/Plugin/Forward.pm.old 2006-06-19 17:32:12.000000000 +0200 +++ /usr/share/perl5/CGI/Application/Plugin/Forward.pm 2007-04-14 18:31:32.000000000 +0200 @@ -7,7 +7,7 @@ use vars qw(@ISA @EXPORT); @ISA = ('Exporter'); -@EXPORT = ('forward'); +@EXPORT = ('forward','advance'); =head1 NAME @@ -188,11 +188,33 @@ return $self->$method(@_); } else { - croak "CAP::Forward: target method $method of run mode $run_mode does not exist"; + croak "CAP::Forward:forward target method $method of run mode $run_mode does not exist"; } } +sub advance { + my $self = shift; + my $run_mode = shift; + + my %rm_map = $self->run_modes; + if (not exists $rm_map{$run_mode}) { + croak "CAP::Forward:advance run mode $run_mode does not exist"; + } + + # from CAP::Redirect + eval { + $self->run_modes( dummy_advance => sub { } ); + $self->prerun_mode('dummy_advance'); + }; + + $self->header_add( -location => sprintf("?%s=%s",$self->mode_param,$run_mode ) ); + $self->header_type('redirect'); + return; + +} + + =head1 HOOKS Before the forwarded run mode is called, the C<forward_prerun> hook is @@ -277,4 +299,4 @@ =cut -1; # End of CGI::Application::Plugin::Forward \ No newline at end of file +1; # End of CGI::Application::Plugin::Forward