| 1 | package CGI::Application::Plugin::Redirect; | ||||||||||
| 2 | |||||||||||
| 3 | 2 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 2 | ▶ | use vars qw($VERSION @EXPORT); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | 2 | $VERSION = '1.00'; | |||||||||
| 7 | |||||||||||
| 8 | 2 | require Exporter; | |||||||||
| 9 | |||||||||||
| 10 | 2 | @EXPORT = qw( | |||||||||
| 11 | redirect | ||||||||||
| 12 | ); | ||||||||||
| 13 | |||||||||||
| 14 | 2 | ▶ | sub import { goto &Exporter::import } | ||||||||
|
Subroutine
import: called CC=1 SCAR=0.0
| |||||||||||
| 15 | |||||||||||
| 16 | 3 | ▶ | sub redirect { | ||||||||
|
Subroutine
redirect: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||
| 17 | 3 | my $self = shift; | |||||||||
| 18 | 3 | my $location = shift; | |||||||||
| 19 | 3 | my $status = shift; | |||||||||
| 20 | |||||||||||
| 21 | # The eval may fail, but we don't care | ||||||||||
| 22 | 3 | eval { | |||||||||
| 23 | 3 | ▶ | $self->run_modes( dummy_redirect => sub { } ); | ||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||
| 24 | 3 | $self->prerun_mode('dummy_redirect'); | |||||||||
| 25 | }; | ||||||||||
| 26 | |||||||||||
| 27 | 3 | ▶ | if ($status) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 28 | 1 | $self->header_add( -location => $location, -status => $status ); | |||||||||
| 29 | } else { | ||||||||||
| 30 | 2 | $self->header_add( -location => $location ); | |||||||||
| 31 | } | ||||||||||
| 32 | 3 | $self->header_type('redirect'); | |||||||||
| 33 | 3 | return; | |||||||||
| 34 | } | ||||||||||
| 35 | |||||||||||
| 36 | 2 | 1; | |||||||||
| 37 | __END__ | ||||||||||