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 0.028;
2             our $AUTHORITY = 'cpan:STEVAN';
3              
4 1     1   816 use Types::Standard qw(Str);
  1         2  
  1         12  
5              
6 1     1   651 use Moo::Role;
  1         3  
  1         11  
7              
8             with(
9             'HTTP::Throwable',
10             'HTTP::Throwable::Role::BoringText',
11             );
12              
13 2     2 0 123 sub default_status_code { 503 }
14 2     2 0 8870 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   505 no Moo::Role; 1;
  1         11  
  1         5  
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.028
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 PERL VERSION
57              
58             This library should run on perls released even a long time ago. It should work
59             on any version of perl released in the last five years.
60              
61             Although it may work on older versions of perl, no guarantee is made that the
62             minimum required version will not be increased. The version may be increased
63             for any reason, and there is no promise that patches will be accepted to lower
64             the minimum required perl.
65              
66             =head1 AUTHORS
67              
68             =over 4
69              
70             =item *
71              
72             Stevan Little
73              
74             =item *
75              
76             Ricardo Signes
77              
78             =back
79              
80             =head1 COPYRIGHT AND LICENSE
81              
82             This software is copyright (c) 2011 by Infinity Interactive, Inc.
83              
84             This is free software; you can redistribute it and/or modify it under
85             the same terms as the Perl 5 programming language system itself.
86              
87             =cut
88              
89             __END__