blib/lib/Web/Authenticate/RedirectHandler.pm untested

filter: Statementstmt 0.0% 0 / 17 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 4 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 26 SCAR 24.8
CC
3
Cov
0%
redirect
12.0
BEGIN
2.0
BEGIN
2.0
CRAP 12.0
1 use strict;
2 package Web::Authenticate::RedirectHandler;
3 $Web::Authenticate::RedirectHandler::VERSION = '0.002';
4 use Mouse;
5 use Carp;
6 #ABSTRACT: The default implementation of Web::Authentication::RedirectHandler::Role.
7  
8 with 'Web::Authenticate::RedirectHandler::Role';
9  
10  
11 has exit_on_redirect => (
12 isa => 'Bool',
13 is => 'ro',
14 required => 1,
15 default => undef,
16 );
17  
18  
19 sub redirect {
20 my ($self, $url) = @_;
21 croak "must provide url" unless $url;
22  
23 print "Location: $url\n\n";
24 exit if $self->exit_on_redirect;
25 }
26  
27 1;
28  
29 __END__
30  
31 =pod
32  
33 =encoding UTF-8
34  
35 =head1 NAME
36  
37 Web::Authenticate::RedirectHandler - The default implementation of Web::Authentication::RedirectHandler::Role.
38  
39 =head1 VERSION
40  
41 version 0.002
42  
43 =head1 METHODS
44  
45 =head2 exit_on_redirect
46  
47 If set to true (1), then when a user is redirected in methods such as L</login> or L</authenticate>, exit will be called instead of returning.
48 Default is false.
49  
50 =head2 redirect
51  
52 Redirects to url.
53  
54 =head1 AUTHOR
55  
56 Adam Hopkins <srchulo@cpan.org>
57  
58 =head1 COPYRIGHT AND LICENSE
59  
60 This software is copyright (c) 2017 by Adam Hopkins.
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