line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Web::Machine::Resource; |
2
|
|
|
|
|
|
|
# ABSTRACT: A base resource class |
3
|
|
|
|
|
|
|
|
4
|
13
|
|
|
13
|
|
9285
|
use strict; |
|
13
|
|
|
|
|
22
|
|
|
13
|
|
|
|
|
412
|
|
5
|
13
|
|
|
13
|
|
51
|
use warnings; |
|
13
|
|
|
|
|
15
|
|
|
13
|
|
|
|
|
519
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.16'; |
8
|
|
|
|
|
|
|
|
9
|
13
|
|
|
13
|
|
57
|
use Carp qw[ confess ]; |
|
13
|
|
|
|
|
12
|
|
|
13
|
|
|
|
|
751
|
|
10
|
13
|
|
|
13
|
|
59
|
use Scalar::Util qw[ blessed ]; |
|
13
|
|
|
|
|
27
|
|
|
13
|
|
|
|
|
6594
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub new { |
13
|
124
|
|
|
124
|
0
|
79067
|
my ($class, %args) = @_; |
14
|
|
|
|
|
|
|
|
15
|
124
|
50
|
33
|
|
|
1282
|
(exists $args{'request'} && blessed $args{'request'} && $args{'request'}->isa('Plack::Request')) |
|
|
|
33
|
|
|
|
|
16
|
|
|
|
|
|
|
|| confess "You must supply a request and it must be a Plack::Request"; |
17
|
|
|
|
|
|
|
|
18
|
124
|
50
|
33
|
|
|
1004
|
(exists $args{'response'} && blessed $args{'response'} && $args{'response'}->isa('Plack::Response')) |
|
|
|
33
|
|
|
|
|
19
|
|
|
|
|
|
|
|| confess "You must supply a response and it must be a Plack::Response"; |
20
|
|
|
|
|
|
|
|
21
|
124
|
|
|
|
|
367
|
my $self = bless { |
22
|
|
|
|
|
|
|
request => $args{'request'}, |
23
|
|
|
|
|
|
|
response => $args{'response'}, |
24
|
|
|
|
|
|
|
} => $class; |
25
|
|
|
|
|
|
|
|
26
|
124
|
|
|
|
|
450
|
$self->init( \%args ); |
27
|
124
|
|
|
|
|
309
|
$self; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
124
|
|
|
124
|
1
|
140
|
sub init {} |
31
|
|
|
|
|
|
|
|
32
|
329
|
|
|
329
|
1
|
988
|
sub request { (shift)->{'request'} } |
33
|
257
|
|
|
257
|
1
|
457
|
sub response { (shift)->{'response'} } |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
# NOTE: |
36
|
|
|
|
|
|
|
# this is where we deviate from |
37
|
|
|
|
|
|
|
# the Erlang/Ruby versions |
38
|
|
|
|
|
|
|
# - SL |
39
|
9
|
|
|
9
|
1
|
31
|
sub create_path_after_handler { 0 } |
40
|
|
|
|
|
|
|
|
41
|
59
|
|
|
59
|
1
|
211
|
sub resource_exists { 1 } |
42
|
122
|
|
|
122
|
1
|
444
|
sub service_available { 1 } |
43
|
113
|
|
|
113
|
1
|
2780
|
sub is_authorized { 1 } |
44
|
112
|
|
|
112
|
1
|
363
|
sub forbidden { 0 } |
45
|
0
|
|
|
0
|
1
|
0
|
sub allow_missing_post { 0 } |
46
|
118
|
|
|
118
|
1
|
380
|
sub malformed_request { 0 } |
47
|
120
|
|
|
120
|
1
|
59679
|
sub uri_too_long { 0 } |
48
|
109
|
|
|
109
|
1
|
2609
|
sub known_content_type { 1 } |
49
|
111
|
|
|
111
|
1
|
540
|
sub valid_content_headers { 1 } |
50
|
109
|
|
|
109
|
1
|
864
|
sub valid_entity_length { 1 } |
51
|
0
|
|
|
0
|
1
|
0
|
sub options { +{} } |
52
|
54
|
|
|
54
|
1
|
183
|
sub allowed_methods { [qw[ GET HEAD ]] } |
53
|
119
|
|
|
119
|
1
|
501
|
sub known_methods { [qw[ GET HEAD POST PUT DELETE TRACE CONNECT OPTIONS ]]} |
54
|
0
|
|
|
0
|
1
|
0
|
sub delete_resource { 0 } |
55
|
0
|
|
|
0
|
1
|
0
|
sub delete_completed { 1 } |
56
|
2
|
|
|
2
|
1
|
6
|
sub post_is_create { 0 } |
57
|
0
|
|
|
0
|
1
|
0
|
sub create_path { undef } |
58
|
3
|
|
|
3
|
1
|
14
|
sub base_uri { undef } |
59
|
0
|
|
|
0
|
1
|
0
|
sub process_post { 0 } |
60
|
0
|
|
|
0
|
1
|
0
|
sub content_types_provided { [] } |
61
|
0
|
|
|
0
|
1
|
0
|
sub content_types_accepted { [] } |
62
|
46
|
|
|
46
|
1
|
179
|
sub charsets_provided { [] } |
63
|
89
|
|
|
89
|
1
|
269
|
sub default_charset {} |
64
|
38
|
|
|
38
|
1
|
115
|
sub languages_provided { [] } |
65
|
131
|
|
|
131
|
1
|
400
|
sub encodings_provided { { 'identity' => sub { $_[1] } } } |
|
152
|
|
|
152
|
|
766
|
|
66
|
94
|
|
|
94
|
1
|
396
|
sub variances { [] } |
67
|
7
|
|
|
7
|
1
|
23
|
sub is_conflict { 0 } |
68
|
38
|
|
|
38
|
1
|
109
|
sub multiple_choices { 0 } |
69
|
2
|
|
|
2
|
1
|
7
|
sub previously_existed { 0 } |
70
|
24
|
|
|
24
|
1
|
72
|
sub moved_permanently { 0 } |
71
|
16
|
|
|
16
|
1
|
50
|
sub moved_temporarily { 0 } |
72
|
36
|
|
|
36
|
1
|
110
|
sub last_modified { undef } |
73
|
43
|
|
|
43
|
1
|
108
|
sub expires { undef } |
74
|
37
|
|
|
37
|
1
|
110
|
sub generate_etag { undef } |
75
|
120
|
|
|
120
|
1
|
183
|
sub finish_request {} |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
1; |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
__END__ |