File Coverage

blib/lib/HTTP/Throwable/Role/Status/MultipleChoices.pm
Criterion Covered Total %
statement 11 11 100.0
branch n/a
condition n/a
subroutine 5 5 100.0
pod 0 2 0.0
total 16 18 88.8


line stmt bran cond sub pod time code
1             package HTTP::Throwable::Role::Status::MultipleChoices 0.028;
2             our $AUTHORITY = 'cpan:STEVAN';
3              
4 1     1   1264 use Types::Standard qw(Str);
  1         76992  
  1         10  
5              
6 1     1   1290 use Moo::Role;
  1         15296  
  1         5  
7              
8             with(
9             'HTTP::Throwable',
10             'HTTP::Throwable::Role::BoringText',
11             );
12              
13 2     2 0 86 sub default_status_code { 300 }
14 2     2 0 9191 sub default_reason { 'Multiple Choices' }
15              
16             has 'location' => ( is => 'ro', isa => Str );
17              
18             around 'build_headers' => sub {
19             my $next = shift;
20             my $self = shift;
21             my $headers = $self->$next( @_ );
22             if ( my $location = $self->location ) {
23             push @$headers => ('Location' => $location);
24             }
25             $headers;
26             };
27              
28 1     1   471 no Moo::Role; 1;
  1         4  
  1         5  
29              
30             =pod
31              
32             =encoding UTF-8
33              
34             =head1 NAME
35              
36             HTTP::Throwable::Role::Status::MultipleChoices - 300 Multiple Choices
37              
38             =head1 VERSION
39              
40             version 0.028
41              
42             =head1 DESCRIPTION
43              
44             The requested resource corresponds to any one of a set of representations,
45             each with its own specific location, and agent-driven negotiation information
46             is being provided so that the user (or user agent) can select a preferred
47             representation and redirect its request to that location.
48              
49             Unless it was a HEAD request, the response SHOULD include an entity containing
50             a list of resource characteristics and location(s) from which the user or user
51             agent can choose the one most appropriate. The entity format is specified by
52             the media type given in the Content-Type header field. Depending upon the
53             format and the capabilities of the user agent, selection of the most appropriate
54             choice MAY be performed automatically. However, this specification does not
55             define any standard for such automatic selection.
56              
57             If the server has a preferred choice of representation, it SHOULD include
58             the specific URI for that representation in the Location field; user agents
59             MAY use the Location field value for automatic redirection. This response is
60             cacheable unless indicated otherwise.
61              
62             =head1 PERL VERSION
63              
64             This library should run on perls released even a long time ago. It should work
65             on any version of perl released in the last five years.
66              
67             Although it may work on older versions of perl, no guarantee is made that the
68             minimum required version will not be increased. The version may be increased
69             for any reason, and there is no promise that patches will be accepted to lower
70             the minimum required perl.
71              
72             =head1 ATTRIBUTES
73              
74             =head2 location
75              
76             This is an optional string, which, if supplied, will be used in the Location
77             header when creating a PSGI response.
78              
79             Note that this is I (at present) the location attribute provided by the
80             role L, which this role does not include.
81              
82             =head1 AUTHORS
83              
84             =over 4
85              
86             =item *
87              
88             Stevan Little
89              
90             =item *
91              
92             Ricardo Signes
93              
94             =back
95              
96             =head1 COPYRIGHT AND LICENSE
97              
98             This software is copyright (c) 2011 by Infinity Interactive, Inc.
99              
100             This is free software; you can redistribute it and/or modify it under
101             the same terms as the Perl 5 programming language system itself.
102              
103             =cut
104              
105             __END__