Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
better description for stream method
  • Loading branch information
kraih committed Oct 27, 2011
1 parent a90c401 commit c7c7c18
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
12 changes: 6 additions & 6 deletions lib/Mojo/IOLoop.pm
Expand Up @@ -230,7 +230,7 @@ sub stream {
my $stream = shift;
my $args = ref $_[0] ? $_[0] : {@_};

# Find stream by id
# Find stream for id
unless (blessed $stream) {
return unless my $c = $self->{connections}->{$stream};
return $c->{stream};
Expand Down Expand Up @@ -917,12 +917,12 @@ and the loop can be restarted by running C<start> again.
=head2 C<stream>
my $stream = Mojo::IOLoop->stream($id);
my $stream = $loop->stream($id);
my $id = $loop->stream($stream, on_read => sub {...});
my $id = $loop->stream($stream, {on_read => sub {...}});
my $stream = Mojo::IOLoop->stream($id);
my $stream = $loop->stream($id);
my $id = $loop->stream($stream, on_read => sub {...});
my $id = $loop->stream($stream, {on_read => sub {...}});
Turn L<Mojo::IOLoop::Stream> object into connection.
Get L<Mojo::IOLoop::Stream> object for id or turn object into a connection.
Note that this method is EXPERIMENTAL and might change without warning!
These options are currently available:
Expand Down
8 changes: 4 additions & 4 deletions t/mojo/request.t
Expand Up @@ -132,11 +132,11 @@ $req->parse("Content-Length: 120000\x0d\x0a\x0d\x0a" . 'c' x 120000);
ok $req->has_leftovers, 'has leftovers';
is length($req->leftovers), 240092, 'right size';
$req->parse("GET /four HTTP/1.1\x0d\x0a");
$req->parse("Content-Length: 120000\x0d\x0a\x0d\x0a" . 'c' x 120000);
$req->parse("Content-Length: 120000\x0d\x0a\x0d\x0a" . 'd' x 120000);
ok $req->has_leftovers, 'has leftovers';
is length($req->leftovers), 360138, 'right size';
$req->parse("GET /five HTTP/1.1\x0d\x0a");
$req->parse("Content-Length: 120000\x0d\x0a\x0d\x0a" . 'c' x 120000);
$req->parse("Content-Length: 120000\x0d\x0a\x0d\x0a" . 'e' x 120000);
ok $req->has_leftovers, 'has leftovers';
is length($req->leftovers), 360138, 'right size';
is $req->error, undef, 'no error';
Expand Down Expand Up @@ -167,11 +167,11 @@ $req->parse("Content-Length: 120000\x0d\x0a\x0d\x0a" . 'c' x 120000);
ok $req->has_leftovers, 'has leftovers';
is length($req->leftovers), 240092, 'right size';
$req->parse("GET /four HTTP/1.1\x0d\x0a");
$req->parse("Content-Length: 120000\x0d\x0a\x0d\x0a" . 'c' x 120000);
$req->parse("Content-Length: 120000\x0d\x0a\x0d\x0a" . 'd' x 120000);
ok $req->has_leftovers, 'has leftovers';
is length($req->leftovers), 360138, 'right size';
$req->parse("GET /five HTTP/1.1\x0d\x0a");
$req->parse("Content-Length: 120000\x0d\x0a\x0d\x0a" . 'c' x 120000);
$req->parse("Content-Length: 120000\x0d\x0a\x0d\x0a" . 'e' x 120000);
ok $req->has_leftovers, 'has leftovers';
is length($req->leftovers), 360138, 'right size';
is $req->error, undef, 'no error';
Expand Down

0 comments on commit c7c7c18

Please sign in to comment.