- Port to Moose
- Added test for action stringify
- Added test for component instances getting $self->{value} from config.
- - Chained doc improvements (rev 8326-8328)
+ - Add Catalyst::Response->print() method (ilmari)
+
+ ))
5.7XXXXXX XXXX
- Fix some Win32 test failures
Geoff Richards
+ilmari: Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>
+
jcamacho: Juan Camacho
Jody Belka
Provided by Moose
+=head2 $res->print( @data )
+
+Prints @data to the output stream, separated by $,. This lets you pass
+the response object to functions that want to write to an L<IO::Handle>.
+
+=cut
+
+sub print {
+ my $self = shift;
+ my $data = shift;
+
+ defined $self->write($data) or return;
+
+ for (@_) {
+ defined $self->write($,) or return;
+ defined $self->write($_) or return;
+ }
+
+ return 1;
+}
+
=head1 AUTHORS
Catalyst Contributors, see Catalyst.pm
--- /dev/null
+package TestApp::Controller::Engine::Response::Print;
+
+use strict;
+use base 'Catalyst::Base';
+
+sub one :Relative {
+ my ( $self, $c ) = @_;
+
+ $c->res->print("foo");
+}
+
+sub two :Relative {
+ my ( $self, $c ) = @_;
+
+ $c->res->print(qw/foo bar/);
+}
+
+sub three :Relative {
+ my ( $self, $c ) = @_;
+
+ local $, = ',';
+ $c->res->print(qw/foo bar baz/);
+}
+
+1;
--- /dev/null
+#!perl
+
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/lib";
+
+use Test::More tests => 9;
+use Catalyst::Test 'TestApp';
+
+my $expected = {
+ one => "foo",
+ two => "foobar",
+ three => "foo,bar,baz",
+};
+
+for my $action ( keys %{$expected} ) {
+ ok( my $response = request('http://localhost/engine/response/print/' . $action ),
+ 'Request' );
+ ok( $response->is_success, "Response $action successful 2xx" );
+
+ is( $response->content, $expected->{$action}, "Content $action OK" );
+}