| 1 | package POE::Component::Server::SimpleHTTP::Response; | ||||||||||||
| 2 | 9 | $POE::Component::Server::SimpleHTTP::Response::VERSION = '2.30'; | |||||||||||
| 3 | #ABSTRACT: Emulates a HTTP::Response object, used for SimpleHTTP | ||||||||||||
| 4 | |||||||||||||
| 5 | 9 | ▶ | use strict; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 6 | 9 | ▶ | use warnings; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 7 | |||||||||||||
| 8 | 9 | ▶ | use base qw( HTTP::Response ); | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 9 | |||||||||||||
| 10 | 9 | ▶ | use Moose; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 11 | 9 | extends qw(HTTP::Response Moose::Object ); | |||||||||||
| 12 | |||||||||||||
| 13 | 9 | has '_WHEEL' => ( | |||||||||||
| 14 | is => 'rw', | ||||||||||||
| 15 | ); | ||||||||||||
| 16 | |||||||||||||
| 17 | 9 | has 'connection' => ( | |||||||||||
| 18 | is => 'ro', | ||||||||||||
| 19 | writer => 'set_connection', | ||||||||||||
| 20 | ); | ||||||||||||
| 21 | |||||||||||||
| 22 | 9 | has 'STREAM_SESSION' => ( | |||||||||||
| 23 | is => 'rw', | ||||||||||||
| 24 | ); | ||||||||||||
| 25 | |||||||||||||
| 26 | 9 | has 'STREAM' => ( | |||||||||||
| 27 | is => 'rw', | ||||||||||||
| 28 | ); | ||||||||||||
| 29 | |||||||||||||
| 30 | has 'STREAM_DONE' => ( | ||||||||||||
| 31 | is => 'ro', | ||||||||||||
| 32 | 13 | ▶ | default => sub { 0 }, | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 33 | 9 | writer => 'set_stream_done', | |||||||||||
| 34 | init_arg => undef, | ||||||||||||
| 35 | ); | ||||||||||||
| 36 | |||||||||||||
| 37 | 9 | has 'IS_STREAMING' => ( | |||||||||||
| 38 | is => 'ro', | ||||||||||||
| 39 | writer => 'set_streaming', | ||||||||||||
| 40 | ); | ||||||||||||
| 41 | |||||||||||||
| 42 | 9 | has 'DONT_FLUSH' => ( | |||||||||||
| 43 | is => 'rw', | ||||||||||||
| 44 | isa => 'Bool', | ||||||||||||
| 45 | ); | ||||||||||||
| 46 | |||||||||||||
| 47 | 13 | ▶ | sub new { | ||||||||||
|
Subroutine
new: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||||
| 48 | 13 | my $class = shift; | |||||||||||
| 49 | |||||||||||||
| 50 | # Get the Wheel ID | ||||||||||||
| 51 | 13 | my $wid = shift; | |||||||||||
| 52 | |||||||||||||
| 53 | # Get the Connection object | ||||||||||||
| 54 | 13 | my $conn = shift; | |||||||||||
| 55 | |||||||||||||
| 56 | # Make sure we got the wheel ID! | ||||||||||||
| 57 | 13 | ▶ | if ( !defined $wid ) { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 58 | 0 | die 'Did not get a Wheel ID!'; | |||||||||||
| 59 | } | ||||||||||||
| 60 | |||||||||||||
| 61 | 13 | my $self = $class->SUPER::new(@_); | |||||||||||
| 62 | |||||||||||||
| 63 | 13 | return $class->meta->new_object( | |||||||||||
| 64 | __INSTANCE__ => $self, | ||||||||||||
| 65 | _WHEEL => $wid, | ||||||||||||
| 66 | connection => $conn, | ||||||||||||
| 67 | ); | ||||||||||||
| 68 | } | ||||||||||||
| 69 | |||||||||||||
| 70 | 0 | ▶ | sub stream { | ||||||||||
|
Subroutine
stream: not called CC=3 SCAR=20.0
Pod
undocumented
| |||||||||||||
| 71 | 0 | my $self = shift; | |||||||||||
| 72 | 0 | my %opt = (@_); | |||||||||||
| 73 | |||||||||||||
| 74 | 9 | ▶ | no strict 'refs'; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 75 | |||||||||||||
| 76 | 0 | ▶ | if ( $opt{event} ne '' ) { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 77 | 0 | ▶ | $self->STREAM_SESSION( $opt{'session'} || undef ); | ||||||||||
|
Condition0%0/2
$opt{'session'} || undef
MC/DC0%0/1
$opt{'session'} || undef
$opt{'session'}
Truth table0%0/2
A
A= $opt{'session'}
| |||||||||||||
| 78 | 0 | $self->STREAM( $opt{'event'} ); | |||||||||||
| 79 | 0 | $self->DONT_FLUSH( $opt{'dont_flush'} ); | |||||||||||
| 80 | } | ||||||||||||
| 81 | else { | ||||||||||||
| 82 | 0 | $self->STREAM( shift ); | |||||||||||
| 83 | } | ||||||||||||
| 84 | } | ||||||||||||
| 85 | |||||||||||||
| 86 | 9 | ▶ | no Moose; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 87 | |||||||||||||
| 88 | 9 | __PACKAGE__->meta->make_immutable( inline_constructor => 0 ); | |||||||||||
| 89 | |||||||||||||
| 90 | # End of module | ||||||||||||
| 91 | 9 | 1; | |||||||||||
| 92 | |||||||||||||
| 93 | __END__ | ||||||||||||