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;
2             our $AUTHORITY = 'cpan:STEVAN';
3             $HTTP::Throwable::Role::Status::MultipleChoices::VERSION = '0.027';
4 1     1   1165 use Types::Standard qw(Str);
  1         75270  
  1         13  
5              
6 1     1   1400 use Moo::Role;
  1         14374  
  1         5  
7              
8             with(
9             'HTTP::Throwable',
10             'HTTP::Throwable::Role::BoringText',
11             );
12              
13 2     2 0 83 sub default_status_code { 300 }
14 2     2 0 9410 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   496 no Moo::Role; 1;
  1         3  
  1         4  
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.027
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 ATTRIBUTES
63              
64             =head2 location
65              
66             This is an optional string, which, if supplied, will be used in the Location
67             header when creating a PSGI response.
68              
69             Note that this is I (at present) the location attribute provided by the
70             role L, which this role does not include.
71              
72             =head1 AUTHORS
73              
74             =over 4
75              
76             =item *
77              
78             Stevan Little
79              
80             =item *
81              
82             Ricardo Signes
83              
84             =back
85              
86             =head1 COPYRIGHT AND LICENSE
87              
88             This software is copyright (c) 2011 by Infinity Interactive, Inc.
89              
90             This is free software; you can redistribute it and/or modify it under
91             the same terms as the Perl 5 programming language system itself.
92              
93             =cut
94              
95             __END__