1package HTTP::Throwable::Role::Status::MultipleChoices; 2our $AUTHORITY = 'cpan:STEVAN'; 3$HTTP::Throwable::Role::Status::MultipleChoices::VERSION = '0.027'; 4use Types::Standard qw(Str); 5 6use Moo::Role; 7 8with( 9 'HTTP::Throwable', 10 'HTTP::Throwable::Role::BoringText', 11); 12 13sub default_status_code { 300 } 14sub default_reason { 'Multiple Choices' } 15 16has 'location' => ( is => 'ro', isa => Str ); 17 18around '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 28no Moo::Role; 1; 29 30=pod 31 32=encoding UTF-8 33 34=head1 NAME 35 36HTTP::Throwable::Role::Status::MultipleChoices - 300 Multiple Choices 37 38=head1 VERSION 39 40version 0.027 41 42=head1 DESCRIPTION 43 44The requested resource corresponds to any one of a set of representations, 45each with its own specific location, and agent-driven negotiation information 46is being provided so that the user (or user agent) can select a preferred 47representation and redirect its request to that location. 48 49Unless it was a HEAD request, the response SHOULD include an entity containing 50a list of resource characteristics and location(s) from which the user or user 51agent can choose the one most appropriate. The entity format is specified by 52the media type given in the Content-Type header field. Depending upon the 53format and the capabilities of the user agent, selection of the most appropriate 54choice MAY be performed automatically. However, this specification does not 55define any standard for such automatic selection. 56 57If the server has a preferred choice of representation, it SHOULD include 58the specific URI for that representation in the Location field; user agents 59MAY use the Location field value for automatic redirection. This response is 60cacheable unless indicated otherwise. 61 62=head1 ATTRIBUTES 63 64=head2 location 65 66This is an optional string, which, if supplied, will be used in the Location 67header when creating a PSGI response. 68 69Note that this is I<not> (at present) the location attribute provided by the 70role L<HTTP::Throwable::Role::Redirect>, which this role does not include. 71 72=head1 AUTHORS 73 74=over 4 75 76=item * 77 78Stevan Little <stevan.little@iinteractive.com> 79 80=item * 81 82Ricardo Signes <rjbs@cpan.org> 83 84=back 85 86=head1 COPYRIGHT AND LICENSE 87 88This software is copyright (c) 2011 by Infinity Interactive, Inc. 89 90This is free software; you can redistribute it and/or modify it under 91the same terms as the Perl 5 programming language system itself. 92 93=cut 94 95__END__ 96 97# ABSTRACT: 300 Multiple Choices 98 99#pod =head1 DESCRIPTION 100#pod 101#pod The requested resource corresponds to any one of a set of representations, 102#pod each with its own specific location, and agent-driven negotiation information 103#pod is being provided so that the user (or user agent) can select a preferred 104#pod representation and redirect its request to that location. 105#pod 106#pod Unless it was a HEAD request, the response SHOULD include an entity containing 107#pod a list of resource characteristics and location(s) from which the user or user 108#pod agent can choose the one most appropriate. The entity format is specified by 109#pod the media type given in the Content-Type header field. Depending upon the 110#pod format and the capabilities of the user agent, selection of the most appropriate 111#pod choice MAY be performed automatically. However, this specification does not 112#pod define any standard for such automatic selection. 113#pod 114#pod If the server has a preferred choice of representation, it SHOULD include 115#pod the specific URI for that representation in the Location field; user agents 116#pod MAY use the Location field value for automatic redirection. This response is 117#pod cacheable unless indicated otherwise. 118#pod 119#pod =attr location 120#pod 121#pod This is an optional string, which, if supplied, will be used in the Location 122#pod header when creating a PSGI response. 123#pod 124#pod Note that this is I<not> (at present) the location attribute provided by the 125#pod role L<HTTP::Throwable::Role::Redirect>, which this role does not include. 126