Permalink
Browse files

improved Mojo::ByteStream to allow more method chaining

  • Loading branch information...
1 parent ae504b7 commit dda5509f7c347d9b6461a217821186da4bcbf5c7 @kraih committed Mar 4, 2014
Showing with 6 additions and 4 deletions.
  1. +1 −0 Changes
  2. +3 −2 lib/Mojo/ByteStream.pm
  3. +2 −2 t/mojo/bytestream.t
View
@@ -1,5 +1,6 @@
4.87 2014-03-04
+ - Improved Mojo::ByteStream to allow more method chaining.
- Fixed RFC 7159 support in Mojo::JSON.
- Fixed RFC 7159 compliance bugs in Mojo::Transaction::WebSocket and
Test::Mojo.
View
@@ -49,6 +49,7 @@ sub say {
my ($self, $handle) = @_;
$handle ||= \*STDOUT;
say $handle $$self;
+ return $self;
}
sub secure_compare { Mojo::Util::secure_compare ${shift()}, @_ }
@@ -218,8 +219,8 @@ Quote bytestream with L<Mojo::Util/"quote">.
=head2 say
- $stream->say;
- $stream->say(*STDERR);
+ $stream = $stream->say;
+ $stream = $stream->say(*STDERR);
Print bytestream to handle and append a newline, defaults to C<STDOUT>.
View
@@ -134,9 +134,9 @@ open my $handle, '>', \$buffer;
b('te', 'st')->say($handle);
{
local *STDOUT = $handle;
- b(1, 2, 3)->say;
+ b(1, 2, 3)->say->quote->say;
}
-is $buffer, "test\n123\n", 'right output';
+is $buffer, "test\n123\n\"123\"\n", 'right output';
# slurp
my $file = catfile splitdir($FindBin::Bin), qw(templates exception.mt);

0 comments on commit dda5509

Please sign in to comment.