line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTTP::Throwable::Role::Status::MethodNotAllowed; |
2
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:STEVAN'; |
3
|
|
|
|
|
|
|
$HTTP::Throwable::Role::Status::MethodNotAllowed::VERSION = '0.027'; |
4
|
2
|
|
|
2
|
|
2261
|
use Type::Utils qw(subtype as where enum); |
|
2
|
|
|
|
|
10030
|
|
|
2
|
|
|
|
|
24
|
|
5
|
2
|
|
|
2
|
|
1668
|
use Types::Standard qw(ArrayRef); |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
10
|
|
6
|
2
|
|
|
2
|
|
1508
|
use List::Util 1.45 qw[ uniq ]; |
|
2
|
|
|
|
|
56
|
|
|
2
|
|
|
|
|
222
|
|
7
|
|
|
|
|
|
|
|
8
|
2
|
|
|
2
|
|
28
|
use Moo::Role; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
17
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
with( |
11
|
|
|
|
|
|
|
'HTTP::Throwable', |
12
|
|
|
|
|
|
|
'HTTP::Throwable::Role::BoringText', |
13
|
|
|
|
|
|
|
); |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
my $method_enum_type = enum "HttpThrowableTypeMethod" => [ qw[ |
16
|
|
|
|
|
|
|
OPTIONS GET HEAD |
17
|
|
|
|
|
|
|
POST PUT DELETE |
18
|
|
|
|
|
|
|
TRACE CONNECT |
19
|
|
|
|
|
|
|
] ]; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
# TODO: Consider adding a coersion to upper-case lower-cased strings and to |
22
|
|
|
|
|
|
|
# uniq the given input. -- rjbs, 2011-02-21 |
23
|
|
|
|
|
|
|
my $method_list_type = subtype "HttpThrowableTypeMethodList", |
24
|
|
|
|
|
|
|
as ArrayRef[ $method_enum_type ], |
25
|
|
|
|
|
|
|
where { (scalar uniq @{$_}) == (scalar @{$_}) }; |
26
|
|
|
|
|
|
|
|
27
|
3
|
|
|
3
|
0
|
123
|
sub default_status_code { 405 } |
28
|
3
|
|
|
3
|
0
|
262
|
sub default_reason { 'Method Not Allowed' } |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
has 'allow' => ( |
31
|
|
|
|
|
|
|
is => 'ro', |
32
|
|
|
|
|
|
|
isa => $method_list_type, |
33
|
|
|
|
|
|
|
required => 1 |
34
|
|
|
|
|
|
|
); |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
around 'build_headers' => sub { |
37
|
|
|
|
|
|
|
my $next = shift; |
38
|
|
|
|
|
|
|
my $self = shift; |
39
|
|
|
|
|
|
|
my $headers = $self->$next( @_ ); |
40
|
|
|
|
|
|
|
push @$headers => ('Allow' => join "," => @{ $self->allow }); |
41
|
|
|
|
|
|
|
$headers; |
42
|
|
|
|
|
|
|
}; |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
|
45
|
2
|
|
|
2
|
|
1175
|
no Moo::Role; 1; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
10
|
|
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=pod |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=encoding UTF-8 |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=head1 NAME |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
HTTP::Throwable::Role::Status::MethodNotAllowed - 405 Method Not Allowed |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head1 VERSION |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
version 0.027 |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head1 DESCRIPTION |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
The method specified in the Request-Line is not allowed for the |
62
|
|
|
|
|
|
|
resource identified by the Request-URI. The response MUST include |
63
|
|
|
|
|
|
|
an Allow header containing a list of valid methods for the requested |
64
|
|
|
|
|
|
|
resource. |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head2 allow |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
This is an ArrayRef of HTTP methods, it is required and the HTTP |
71
|
|
|
|
|
|
|
methods will be type checked to ensure validity and uniqueness. |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head1 SEE ALSO |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
HTTP Methods - L |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=head1 AUTHORS |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=over 4 |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=item * |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
Stevan Little |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=item * |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
Ricardo Signes |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=back |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
This software is copyright (c) 2011 by Infinity Interactive, Inc. |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
96
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=cut |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
__END__ |