« Throwable/Role/Status/InternalServerError.pm
↑ Summary
Throwable/Role/Status/ServiceUnavailable.pm »
| 1 | package HTTP::Throwable::Role::Status::MultipleChoices 0.028; | ||||||||||
| 2 | 1 | our $AUTHORITY = 'cpan:STEVAN'; | |||||||||
| 3 | |||||||||||
| 4 | 1 | ▶ | use Types::Standard qw(Str); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | 1 | ▶ | use Moo::Role; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | 1 | with( | |||||||||
| 9 | 'HTTP::Throwable', | ||||||||||
| 10 | 'HTTP::Throwable::Role::BoringText', | ||||||||||
| 11 | ); | ||||||||||
| 12 | |||||||||||
| 13 | 2 | ▶ | sub default_status_code { 300 } | ||||||||
|
Subroutine
default_status_code: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 14 | 2 | ▶ | sub default_reason { 'Multiple Choices' } | ||||||||
|
Subroutine
default_reason: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 15 | |||||||||||
| 16 | 1 | has 'location' => ( is => 'ro', isa => Str ); | |||||||||
| 17 | |||||||||||
| 18 | 2 | ▶ | around 'build_headers' => sub { | ||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.0
| |||||||||||
| 19 | 2 | my $next = shift; | |||||||||
| 20 | 2 | my $self = shift; | |||||||||
| 21 | 2 | my $headers = $self->$next( @_ ); | |||||||||
| 22 | 2 | ▶ | if ( my $location = $self->location ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 23 | 2 | push @$headers => ('Location' => $location); | |||||||||
| 24 | } | ||||||||||
| 25 | 2 | $headers; | |||||||||
| 26 | 1 | }; | |||||||||
| 27 | |||||||||||
| 28 | 1 | ▶ | no Moo::Role; 1; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 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<not> (at present) the location attribute provided by the | ||||||||||
| 80 | role L<HTTP::Throwable::Role::Redirect>, which this role does not include. | ||||||||||
| 81 | |||||||||||
| 82 | =head1 AUTHORS | ||||||||||
| 83 | |||||||||||
| 84 | =over 4 | ||||||||||
| 85 | |||||||||||
| 86 | =item * | ||||||||||
| 87 | |||||||||||
| 88 | Stevan Little <stevan.little@iinteractive.com> | ||||||||||
| 89 | |||||||||||
| 90 | =item * | ||||||||||
| 91 | |||||||||||
| 92 | Ricardo Signes <cpan@semiotic.systems> | ||||||||||
| 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__ | ||||||||||