Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Mar 2, 2010
1 parent 74fe0da commit e84033c
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions lib/Mojo/Server/PSGI.pm
Expand Up @@ -51,30 +51,30 @@ sub run {
}

# Response body
my $body = Mojo::Server::PSGI::Handle->new(res => $res);
my $body = Mojo::Server::PSGI::_Handle->new(_res => $res);

return [$status, \@headers, $body];
}

package Mojo::Server::PSGI::Handle;
package Mojo::Server::PSGI::_Handle;

use strict;
use warnings;

use base 'Mojo::Base';

__PACKAGE__->attr(offset => 0);
__PACKAGE__->attr('res');
__PACKAGE__->attr(_offset => 0);
__PACKAGE__->attr('_res');

sub close { }

sub getline {
my $self = shift;

# Blocking read
my $offset = $self->offset;
my $offset = $self->_offset;
while (1) {
my $chunk = $self->res->get_body_chunk($offset);
my $chunk = $self->_res->get_body_chunk($offset);

# No content yet, try again
unless (defined $chunk) {
Expand All @@ -87,7 +87,7 @@ sub getline {

# Content
$offset += length $chunk;
$self->offset($offset);
$self->_offset($offset);
return $chunk;
}

Expand Down

0 comments on commit e84033c

Please sign in to comment.