File Coverage

blib/lib/HTTP/Throwable/Role/Status/ServiceUnavailable.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::ServiceUnavailable;
2             our $AUTHORITY = 'cpan:STEVAN';
3             $HTTP::Throwable::Role::Status::ServiceUnavailable::VERSION = '0.026';
4 1     1   767 use Types::Standard qw(Str);
  1         1  
  1         10  
5              
6 1     1   514 use Moo::Role;
  1         3  
  1         7  
7              
8             with(
9             'HTTP::Throwable',
10             'HTTP::Throwable::Role::BoringText',
11             );
12              
13 2     2 0 122 sub default_status_code { 503 }
14 2     2 0 7914 sub default_reason { 'Service Unavailable' }
15              
16             has 'retry_after' => ( 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 $retry = $self->retry_after ) {
23             push @$headers => ('Retry-After' => $retry);
24             }
25             $headers;
26             };
27              
28 1     1   440 no Moo::Role; 1;
  1         2  
  1         9  
29              
30             =pod
31              
32             =encoding UTF-8
33              
34             =head1 NAME
35              
36             HTTP::Throwable::Role::Status::ServiceUnavailable - 503 Service Unavailable
37              
38             =head1 VERSION
39              
40             version 0.026
41              
42             =head1 DESCRIPTION
43              
44             The server is currently unable to handle the request due to
45             a temporary overloading or maintenance of the server. The
46             implication is that this is a temporary condition which will
47             be alleviated after some delay. If known, the length of the
48             delay MAY be indicated in a Retry-After header. If no
49             Retry-After is given, the client SHOULD handle the response as
50             it would for a 500 response.
51              
52             Note: The existence of the 503 status code does not imply that a
53             server must use it when becoming overloaded. Some servers may wish
54             to simply refuse the connection.
55              
56             =head1 AUTHORS
57              
58             =over 4
59              
60             =item *
61              
62             Stevan Little
63              
64             =item *
65              
66             Ricardo Signes
67              
68             =back
69              
70             =head1 COPYRIGHT AND LICENSE
71              
72             This software is copyright (c) 2011 by Infinity Interactive, Inc..
73              
74             This is free software; you can redistribute it and/or modify it under
75             the same terms as the Perl 5 programming language system itself.
76              
77             =cut
78              
79             __END__