line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTTP::Status::Const; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
14826
|
use v5.10.0; |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
69
|
|
4
|
|
|
|
|
|
|
|
5
|
2
|
|
|
2
|
|
7
|
use strict; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
53
|
|
6
|
2
|
|
|
2
|
|
10
|
use warnings; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
59
|
|
7
|
|
|
|
|
|
|
|
8
|
2
|
|
|
2
|
|
479
|
use version 0.77; our $VERSION = version->declare('v0.2.0'); |
|
2
|
|
|
|
|
1416
|
|
|
2
|
|
|
|
|
9
|
|
9
|
|
|
|
|
|
|
|
10
|
2
|
|
|
2
|
|
1034
|
use Const::Exporter; |
|
2
|
|
|
|
|
20654
|
|
|
2
|
|
|
|
|
17
|
|
11
|
2
|
|
|
2
|
|
1092
|
use HTTP::Status (); |
|
2
|
|
|
|
|
5755
|
|
|
2
|
|
|
|
|
50
|
|
12
|
2
|
|
|
2
|
|
11
|
use Package::Stash; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
234
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=head1 NAME |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
HTTP::Status::Const - interpolable HTTP status constants |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=for readme plugin version |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=head1 SYNOPSIS |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
use HTTP::Status::Const; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
... |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
$response->status( $HTTP_NOT_FOUND ); |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
... |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
my %handlers => ( |
31
|
|
|
|
|
|
|
$HTTP_OK => sub { ... }, |
32
|
|
|
|
|
|
|
$HTTP_CREATED => sub { ... }, |
33
|
|
|
|
|
|
|
... |
34
|
|
|
|
|
|
|
); |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=head1 DESCRIPTION |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
This module is basically a wrapper around L that allows |
39
|
|
|
|
|
|
|
you to use the constants as read-only scalar variables instead of |
40
|
|
|
|
|
|
|
function names. |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
This means the constants can be used in contexts where you need |
43
|
|
|
|
|
|
|
interpolated variables, such as hash keys or in strings. |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=begin :readme |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
See the L documentation for more details on the POD |
48
|
|
|
|
|
|
|
syntax that this module recognizes. |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
See L for command-line usage. |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head1 INSTALLATION |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
See |
55
|
|
|
|
|
|
|
L. |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=for readme plugin requires heading-level=2 title="Required Modules" |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=for readme plugin changes |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=end :readme |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=head1 SEE ALSO |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
L |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head1 AUTHOR |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
Robert Rothenberg, C<< >> |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
Copyright 2014 Robert Rothenberg. |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
76
|
|
|
|
|
|
|
under the terms of the the Artistic License (2.0). You may obtain a |
77
|
|
|
|
|
|
|
copy of the full license at: |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
L |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=for readme stop |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
Any use, modification, and distribution of the Standard or Modified |
84
|
|
|
|
|
|
|
Versions is governed by this Artistic License. By using, modifying or |
85
|
|
|
|
|
|
|
distributing the Package, you accept this license. Do not use, modify, |
86
|
|
|
|
|
|
|
or distribute the Package, if you do not accept this license. |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
If your Modified Version has been derived from a Modified Version made |
89
|
|
|
|
|
|
|
by someone other than you, you are nevertheless required to ensure that |
90
|
|
|
|
|
|
|
your Modified Version complies with the requirements of this license. |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
This license does not grant you the right to use any trademark, service |
93
|
|
|
|
|
|
|
mark, tradename, or logo of the Copyright Holder. |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
This license includes the non-exclusive, worldwide, free-of-charge |
96
|
|
|
|
|
|
|
patent license to make, have made, use, offer to sell, sell, import and |
97
|
|
|
|
|
|
|
otherwise transfer the Package with respect to any patent claims |
98
|
|
|
|
|
|
|
licensable by the Copyright Holder that are necessarily infringed by the |
99
|
|
|
|
|
|
|
Package. If you institute patent litigation (including a cross-claim or |
100
|
|
|
|
|
|
|
counterclaim) against any party alleging that the Package constitutes |
101
|
|
|
|
|
|
|
direct or contributory patent infringement, then this Artistic License |
102
|
|
|
|
|
|
|
to you shall terminate on the date that such litigation is filed. |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER |
105
|
|
|
|
|
|
|
AND CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. |
106
|
|
|
|
|
|
|
THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR |
107
|
|
|
|
|
|
|
PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY |
108
|
|
|
|
|
|
|
YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR |
109
|
|
|
|
|
|
|
CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR |
110
|
|
|
|
|
|
|
CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, |
111
|
|
|
|
|
|
|
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=for readme continue |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=cut |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
BEGIN { |
118
|
2
|
|
|
2
|
|
20
|
my $stash = Package::Stash->new('HTTP::Status'); |
119
|
2
|
|
|
|
|
88
|
my $syms = $stash->get_all_symbols('CODE'); |
120
|
|
|
|
|
|
|
|
121
|
2
|
|
|
|
|
4
|
my @exports; |
122
|
|
|
|
|
|
|
|
123
|
2
|
|
|
|
|
2
|
foreach my $sym (keys %{$syms}) { |
|
2
|
|
|
|
|
23
|
|
124
|
248
|
100
|
|
|
|
413
|
next unless $sym =~ /^HTTP_/; |
125
|
116
|
|
|
|
|
74
|
my $val = &{$syms->{$sym}}; |
|
116
|
|
|
|
|
158
|
|
126
|
116
|
|
|
|
|
170
|
push @exports, '$' . $sym => $val; |
127
|
|
|
|
|
|
|
} |
128
|
|
|
|
|
|
|
|
129
|
2
|
|
|
|
|
20
|
Const::Exporter->import( default => \@exports ); |
130
|
|
|
|
|
|
|
} |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
1; |