1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
package Web::Response;
use Moose;
use HTTP::Headers;
has status => (
is => 'rw',
isa => 'Int', # XXX restrict to /^[1-5][0-9][0-9]$/
lazy => 1,
default => sub { confess "Status was not supplied" },
);
has headers => (
is => 'rw',
isa => 'HTTP::Headers', # XXX coerce from array/hashref
lazy => 1,
default => sub { HTTP::Headers->new },
handles => {
header => 'header',
content_length => 'content_length',
content_type => 'content_type',
content_encoding => 'content_encoding',
location => [ header => 'Location' ],
},
);
has body => (
is => 'rw',
lazy => 1,
default => sub { [] },
);
has cookies => (
is => 'ro',
isa => 'HashRef',
lazy => 1,
default => sub { +{} },
);
sub redirect {
...
}
sub finalize {
...
}
__PACKAGE__->meta->make_immutable;
no Moose;
1;
|