[Catalyst-commits] r7022 - Catalyst-Runtime/5.70/trunk/lib/Catalyst
andyg at dev.catalyst.perl.org
andyg at dev.catalyst.perl.org
Wed Oct 17 16:46:11 GMT 2007
Author: andyg
Date: 2007-10-17 16:46:11 +0100 (Wed, 17 Oct 2007)
New Revision: 7022
Modified:
Catalyst-Runtime/5.70/trunk/lib/Catalyst/Engine.pm
Log:
Revert Engine.pm change from yesterday
Modified: Catalyst-Runtime/5.70/trunk/lib/Catalyst/Engine.pm
===================================================================
--- Catalyst-Runtime/5.70/trunk/lib/Catalyst/Engine.pm 2007-10-16 19:08:51 UTC (rev 7021)
+++ Catalyst-Runtime/5.70/trunk/lib/Catalyst/Engine.pm 2007-10-17 15:46:11 UTC (rev 7022)
@@ -4,10 +4,10 @@
use base 'Class::Accessor::Fast';
use CGI::Simple::Cookie;
use Data::Dump qw/dump/;
+use Errno 'EWOULDBLOCK';
use HTML::Entities;
use HTTP::Body;
use HTTP::Headers;
-use IO::Select ();
use URI::QueryParam;
use Scalar::Util ();
@@ -622,29 +622,30 @@
$self->{_prepared_write} = 1;
}
- my $wrote;
- my $len = length($buffer);
+ my $len = length($buffer);
+ my $wrote = syswrite STDOUT, $buffer;
- my $sel = IO::Select->new();
- $sel->add( \*STDOUT );
+ if ( !defined $wrote && $! == EWOULDBLOCK ) {
+ # Unable to write on the first try, will retry in the loop below
+ $wrote = 0;
+ }
- while ( $sel->can_write() ) {
- $wrote ||= 0;
-
- my $ret = syswrite STDOUT, $buffer, $CHUNKSIZE, $wrote;
- if ( defined $ret ) {
- $wrote += $ret;
+ if ( defined $wrote && $wrote < $len ) {
+ # We didn't write the whole buffer
+ while (1) {
+ my $ret = syswrite STDOUT, $buffer, $CHUNKSIZE, $wrote;
+ if ( defined $ret ) {
+ $wrote += $ret;
+ }
+ else {
+ next if $! == EWOULDBLOCK;
+ return;
+ }
+
+ last if $wrote >= $len;
}
- else {
- # Write error
- return;
- }
-
- last if $wrote >= $len;
}
- $sel->remove( \*STDOUT );
-
return $wrote;
}
More information about the Catalyst-commits
mailing list