blib/lib/Yukki/Web/Controller/Redirect.pm untested

filter: Statementstmt 0.0% 0 / 22 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 6 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 31 SCAR 17.9
CC
2
Cov
0%
fire
6.0
BEGIN
2.0
BEGIN
2.0
CRAP 6.0
1 package Yukki::Web::Controller::Redirect;
2 $Yukki::Web::Controller::Redirect::VERSION = '0.991_002'; # TRIAL
3  
4 $Yukki::Web::Controller::Redirect::VERSION = '0.991002';use v5.24;
5 use utf8;
6 use Moo;
7  
8 use Yukki::Error qw( http_throw );
9  
10 use namespace::clean;
11  
12 # ABSTRACT: Simple controller for handling internal redirects
13  
14  
15 sub fire {
16 my ($self, $ctx) = @_;
17  
18 my $redirect = $ctx->request->path_parameters->{redirect};
19  
20 http_throw("no redirect URL named") unless $redirect;
21  
22 http_throw("Go to $redirect.", {
23 status => 'MovedPermanently',
24 location => $redirect,
25 });
26 }
27  
28 1;
29  
30 __END__
31  
32 =pod
33  
34 =encoding UTF-8
35  
36 =head1 NAME
37  
38 Yukki::Web::Controller::Redirect - Simple controller for handling internal redirects
39  
40 =head1 VERSION
41  
42 version 0.991_002
43  
44 =head1 DESCRIPTION
45  
46 Simple controller for handling internal redirects.
47  
48 =head1 METHODS
49  
50 =head2 fire
51  
52 When fired, performs the requested redirect.
53  
54 =head1 AUTHOR
55  
56 Andrew Sterling Hanenkamp <hanenkamp@cpan.org>
57  
58 =head1 COPYRIGHT AND LICENSE
59  
60 This software is copyright (c) 2017 by Qubling Software LLC.
61  
62 This is free software; you can redistribute it and/or modify it under
63 the same terms as the Perl 5 programming language system itself.
64  
65 =cut