line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package POE::Component::Server::SimpleHTTP::Response; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
1213
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
28
|
|
4
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
35
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '2.18'; |
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
4
|
use base qw( HTTP::Response ); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
870
|
|
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
32495
|
use Moose; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
extends qw(HTTP::Response Moose::Object ); |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
has '_WHEEL' => ( |
14
|
|
|
|
|
|
|
is => 'rw', |
15
|
|
|
|
|
|
|
); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
has 'connection' => ( |
18
|
|
|
|
|
|
|
is => 'ro', |
19
|
|
|
|
|
|
|
writer => 'set_connection', |
20
|
|
|
|
|
|
|
); |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
has 'STREAM_SESSION' => ( |
23
|
|
|
|
|
|
|
is => 'rw', |
24
|
|
|
|
|
|
|
); |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
has 'STREAM' => ( |
27
|
|
|
|
|
|
|
is => 'rw', |
28
|
|
|
|
|
|
|
); |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
has 'STREAM_DONE' => ( |
31
|
|
|
|
|
|
|
is => 'ro', |
32
|
|
|
|
|
|
|
default => sub { 0 }, |
33
|
|
|
|
|
|
|
writer => 'set_stream_done', |
34
|
|
|
|
|
|
|
init_arg => undef, |
35
|
|
|
|
|
|
|
); |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
has 'IS_STREAMING' => ( |
38
|
|
|
|
|
|
|
is => 'ro', |
39
|
|
|
|
|
|
|
writer => 'set_streaming', |
40
|
|
|
|
|
|
|
); |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
has 'DONT_FLUSH' => ( |
43
|
|
|
|
|
|
|
is => 'rw', |
44
|
|
|
|
|
|
|
isa => 'Bool', |
45
|
|
|
|
|
|
|
); |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub new { |
48
|
|
|
|
|
|
|
my $class = shift; |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
# Get the Wheel ID |
51
|
|
|
|
|
|
|
my $wid = shift; |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
# Get the Connection object |
54
|
|
|
|
|
|
|
my $conn = shift; |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
# Make sure we got the wheel ID! |
57
|
|
|
|
|
|
|
if ( !defined $wid ) { |
58
|
|
|
|
|
|
|
die 'Did not get a Wheel ID!'; |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
my $self = $class->SUPER::new(@_); |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
return $class->meta->new_object( |
64
|
|
|
|
|
|
|
__INSTANCE__ => $self, |
65
|
|
|
|
|
|
|
_WHEEL => $wid, |
66
|
|
|
|
|
|
|
connection => $conn, |
67
|
|
|
|
|
|
|
); |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
sub stream { |
71
|
|
|
|
|
|
|
my $self = shift; |
72
|
|
|
|
|
|
|
my %opt = (@_); |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
no strict 'refs'; |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
if ( $opt{event} ne '' ) { |
77
|
|
|
|
|
|
|
$self->STREAM_SESSION( $opt{'session'} || undef ); |
78
|
|
|
|
|
|
|
$self->STREAM( $opt{'event'} ); |
79
|
|
|
|
|
|
|
$self->DONT_FLUSH( $opt{'dont_flush'} ); |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
else { |
82
|
|
|
|
|
|
|
$self->STREAM( shift ); |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
no Moose; |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable( inline_constructor => 0 ); |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
# End of module |
91
|
|
|
|
|
|
|
1; |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
__END__ |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=head1 NAME |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
POE::Component::Server::SimpleHTTP::Response - Emulates a HTTP::Response object, used for SimpleHTTP |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=head1 SYNOPSIS |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
use POE::Component::Server::SimpleHTTP::Response; |
102
|
|
|
|
|
|
|
my $response = POE::Component::Server::SimpleHTTP::Response->new( $wheel_id, $connection ); |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
print $response->connection->remote_ip; |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=head1 DESCRIPTION |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
This module is used as a drop-in replacement, because we need to store the wheel ID + connection object for the response. |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
Use $response->connection to get the SimpleHTTP::Connection object |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=head2 EXPORT |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
Nothing. |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=head1 SEE ALSO |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
L<POE::Component::Server::SimpleHTTP> |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
L<POE::Component::Server::SimpleHTTP::Connection> |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=head1 AUTHOR |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
Apocalypse E<lt>apocal@cpan.orgE<gt> |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
Copyright 2006 by Apocalypse |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify |
131
|
|
|
|
|
|
|
it under the same terms as Perl itself. |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
=cut |