/usr/share/perl5/POE/Component/Server/SimpleHTTP/Response.pm is in libpoe-component-server-simplehttp-perl 2.18-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 | package POE::Component::Server::SimpleHTTP::Response;
use strict;
use warnings;
our $VERSION = '2.18';
use base qw( HTTP::Response );
use Moose;
extends qw(HTTP::Response Moose::Object );
has '_WHEEL' => (
is => 'rw',
);
has 'connection' => (
is => 'ro',
writer => 'set_connection',
);
has 'STREAM_SESSION' => (
is => 'rw',
);
has 'STREAM' => (
is => 'rw',
);
has 'STREAM_DONE' => (
is => 'ro',
default => sub { 0 },
writer => 'set_stream_done',
init_arg => undef,
);
has 'IS_STREAMING' => (
is => 'ro',
writer => 'set_streaming',
);
has 'DONT_FLUSH' => (
is => 'rw',
isa => 'Bool',
);
sub new {
my $class = shift;
# Get the Wheel ID
my $wid = shift;
# Get the Connection object
my $conn = shift;
# Make sure we got the wheel ID!
if ( !defined $wid ) {
die 'Did not get a Wheel ID!';
}
my $self = $class->SUPER::new(@_);
return $class->meta->new_object(
__INSTANCE__ => $self,
_WHEEL => $wid,
connection => $conn,
);
}
sub stream {
my $self = shift;
my %opt = (@_);
no strict 'refs';
if ( $opt{event} ne '' ) {
$self->STREAM_SESSION( $opt{'session'} || undef );
$self->STREAM( $opt{'event'} );
$self->DONT_FLUSH( $opt{'dont_flush'} );
}
else {
$self->STREAM( shift );
}
}
no Moose;
__PACKAGE__->meta->make_immutable( inline_constructor => 0 );
# End of module
1;
__END__
=head1 NAME
POE::Component::Server::SimpleHTTP::Response - Emulates a HTTP::Response object, used for SimpleHTTP
=head1 SYNOPSIS
use POE::Component::Server::SimpleHTTP::Response;
my $response = POE::Component::Server::SimpleHTTP::Response->new( $wheel_id, $connection );
print $response->connection->remote_ip;
=head1 DESCRIPTION
This module is used as a drop-in replacement, because we need to store the wheel ID + connection object for the response.
Use $response->connection to get the SimpleHTTP::Connection object
=head2 EXPORT
Nothing.
=head1 SEE ALSO
L<POE::Component::Server::SimpleHTTP>
L<POE::Component::Server::SimpleHTTP::Connection>
=head1 AUTHOR
Apocalypse E<lt>apocal@cpan.orgE<gt>
=head1 COPYRIGHT AND LICENSE
Copyright 2006 by Apocalypse
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.
=cut
|