[Catalyst] Patch Engine _properly_ to support IO handles
Andrew Bramble
andrew.bramble at omnilab.com.au
Fri Oct 21 05:03:36 CEST 2005
On Friday 21 October 2005 01:42, Sebastian Riedel wrote:
> Am 20.10.2005 um 09:35 schrieb Andrew Bramble:
> > Maybe if the patch wasn't bass ackwards it would work better.
>
> Thanks applied, now it just needs a test! ;)
>
>
> --
> sebastian
Somewhat cargo culted from engine/response/large.t , tells TestApp to return
'./Changes' as a handle . Tests to see if returned content is same length()
as '-s './Changes' .
-------------- next part --------------
#!perl
use strict;
use warnings;
use FindBin;
use lib "$FindBin::Bin/../../lib";
use Test::More tests => 3;
use IO::File;
package TestApp;
use Catalyst qw[-Engine=Test];
sub iohandle : Global {
my ( $self, $c ) = @_;
my $handle = IO::File->new;
$handle->open( './Changes' ) or die "$!";
$c->response->body( $handle );
}
__PACKAGE__->setup();
package main;
use Catalyst::Test 'TestApp';
ok (my $response = request('http://localhost/iohandle/', 'iohandle') , 'Request' );
ok( $response->is_success, 'Response Successful 2xx' );
is( length( $response->content ), -s './Changes' , 'Length OK' );
More information about the Catalyst
mailing list