File Coverage

blib/lib/HTTP/Throwable/Role/Redirect.pm
Criterion Covered Total %
statement 9 9 100.0
branch n/a
condition n/a
subroutine 3 3 100.0
pod n/a
total 12 12 100.0


line stmt bran cond sub pod time code
1             package HTTP::Throwable::Role::Redirect 0.028;
2             our $AUTHORITY = 'cpan:STEVAN';
3              
4 3     3   1992 use Types::Standard qw(Str);
  3         9  
  3         45  
5              
6 3     3   1891 use Moo::Role;
  3         12  
  3         17  
7              
8             has 'location' => (
9             is => 'ro',
10             isa => Str,
11             required => 1,
12             );
13              
14             around 'build_headers' => sub {
15             my $next = shift;
16             my $self = shift;
17             my $headers = $self->$next( @_ );
18             push @$headers => ('Location' => $self->location);
19              
20             return $headers;
21             };
22              
23 3     3   1271 no Moo::Role; 1;
  3         16  
  3         14  
24              
25             =pod
26              
27             =encoding UTF-8
28              
29             =head1 NAME
30              
31             HTTP::Throwable::Role::Redirect - an exception that is a redirect
32              
33             =head1 VERSION
34              
35             version 0.028
36              
37             =head1 OVERVIEW
38              
39             This is an extremely simple method used by most of the 3xx series of
40             exceptions. It adds a C attribute that will be provided as the
41             Location header when the exception is converted to an HTTP message.
42              
43             Note that "MultipleChoices," the 300 status code is I currently a
44             redirect, as its Location header is optional. This may change in the future of
45             the semantics of this role are refined.
46              
47             =head1 PERL VERSION
48              
49             This library should run on perls released even a long time ago. It should work
50             on any version of perl released in the last five years.
51              
52             Although it may work on older versions of perl, no guarantee is made that the
53             minimum required version will not be increased. The version may be increased
54             for any reason, and there is no promise that patches will be accepted to lower
55             the minimum required perl.
56              
57             =head1 AUTHORS
58              
59             =over 4
60              
61             =item *
62              
63             Stevan Little
64              
65             =item *
66              
67             Ricardo Signes
68              
69             =back
70              
71             =head1 COPYRIGHT AND LICENSE
72              
73             This software is copyright (c) 2011 by Infinity Interactive, Inc.
74              
75             This is free software; you can redistribute it and/or modify it under
76             the same terms as the Perl 5 programming language system itself.
77              
78             =cut
79              
80             __END__