File Coverage

blib/lib/POE/Component/Server/SimpleHTTP/State.pm
Criterion Covered Total %
statement 33 33 100.0
branch 5 10 50.0
condition n/a
subroutine 8 8 100.0
pod 0 3 0.0
total 46 54 85.1


line stmt bran cond sub pod time code
1             package POE::Component::Server::SimpleHTTP::State;
2             $POE::Component::Server::SimpleHTTP::State::VERSION = '2.26';
3 6     6   28 use strict;
  6         8  
  6         178  
4 6     6   26 use warnings;
  6         6  
  6         197  
5 6     6   23 use POE::Wheel::ReadWrite;
  6         9  
  6         205  
6              
7 6     6   20 use Moose;
  6         7  
  6         35  
8              
9             has 'wheel' => (
10             is => 'ro',
11             isa => 'POE::Wheel::ReadWrite',
12             clearer => 'clear_wheel',
13             predicate => 'has_wheel',
14             required => 1,
15             );
16              
17             has 'response' => (
18             is => 'ro',
19             isa => 'POE::Component::Server::SimpleHTTP::Response',
20             writer => 'set_response',
21             clearer => 'clear_response',
22             );
23              
24             has 'request' => (
25             is => 'ro',
26             isa => 'HTTP::Request',
27             writer => 'set_request',
28             clearer => 'clear_request',
29             );
30              
31             has 'connection' => (
32             is => 'ro',
33             isa => 'POE::Component::Server::SimpleHTTP::Connection',
34             writer => 'set_connection',
35             clearer => 'clear_connection',
36             init_arg => undef,
37             );
38              
39             has 'done' => (
40             is => 'ro',
41             isa => 'Bool',
42             init_arg => undef,
43             default => sub { 0 },
44             writer => 'set_done',
45             );
46              
47             has 'streaming' => (
48             is => 'ro',
49             isa => 'Bool',
50             init_arg => undef,
51             default => sub { 0 },
52             writer => 'set_streaming',
53             );
54              
55             sub reset {
56 6     6 0 8 my $self = shift;
57 6         204 $self->clear_response;
58 6         189 $self->clear_request;
59 6         187 $self->set_streaming(0);
60 6         204 $self->set_done(0);
61 6 50       185 $self->wheel->set_output_filter( $self->wheel->get_input_filter ) if $self->has_wheel;
62 6         37 return 1;
63             }
64              
65             sub close_wheel {
66 9     9 0 14 my $self = shift;
67 9 50       285 return unless $self->has_wheel;
68 9         301 $self->wheel->shutdown_input;
69 9         1098 $self->wheel->shutdown_output;
70 9         1182 $self->clear_wheel;
71 9         761 return 1;
72             }
73              
74             sub wheel_alive {
75 24     24 0 34 my $self = shift;
76 24 50       772 return unless $self->has_wheel;
77 24 50       656 return unless defined $self->wheel;
78 24 50       660 return unless $self->wheel->get_input_handle();
79 24         155 return 1;
80             }
81              
82 6     6   31094 no Moose;
  6         9  
  6         26  
83              
84             __PACKAGE__->meta->make_immutable();
85              
86             'This monkey has gone to heaven';
87              
88             __END__
89              
90             =pod
91              
92             =encoding UTF-8
93              
94             =head1 NAME
95              
96             POE::Component::Server::SimpleHTTP::State
97              
98             =head1 VERSION
99              
100             version 2.26
101              
102             =for Pod::Coverage close_wheel
103             reset
104             wheel_alive
105              
106             =head1 AUTHOR
107              
108             Apocalypse <APOCAL@cpan.org>
109              
110             =head1 COPYRIGHT AND LICENSE
111              
112             This software is copyright (c) 2017 by Apocalypse, Chris Williams, Eriam Schaffter, Marlon Bailey and Philip Gwyn.
113              
114             This is free software; you can redistribute it and/or modify it under
115             the same terms as the Perl 5 programming language system itself.
116              
117             =cut