[Catalyst-commits] r8411 - Catalyst-Runtime/5.80/trunk/lib/Catalyst/Engine

rafl at dev.catalyst.perl.org rafl at dev.catalyst.perl.org
Thu Sep 11 22:31:02 BST 2008


Author: rafl
Date: 2008-09-11 22:31:02 +0100 (Thu, 11 Sep 2008)
New Revision: 8411

Modified:
   Catalyst-Runtime/5.80/trunk/lib/Catalyst/Engine/HTTP.pm
Log:
Make the HTTP engine use before instead of around to wrap {prepare,finalize}_read.

This makes the http engine tests pass again.

Still I have no idea why

  around foo => sub {
      shift->(@_);
  };

isn't the same as

  around foo => sub {
      my $orig = shift;
      $orig->(@_);
  };

The first version will also pass the coderef to the original method.

Modified: Catalyst-Runtime/5.80/trunk/lib/Catalyst/Engine/HTTP.pm
===================================================================
--- Catalyst-Runtime/5.80/trunk/lib/Catalyst/Engine/HTTP.pm	2008-09-11 17:53:53 UTC (rev 8410)
+++ Catalyst-Runtime/5.80/trunk/lib/Catalyst/Engine/HTTP.pm	2008-09-11 21:31:02 UTC (rev 8411)
@@ -84,21 +84,19 @@
 
 =cut
 
-around finalize_read => sub {
+before finalize_read => sub {
     # Never ever remove this, it would result in random length output
     # streams if STDIN eq STDOUT (like in the HTTP engine)
     *STDIN->blocking(1);
-    shift->(@_);
 };
 
 =head2 $self->prepare_read($c)
 
 =cut
 
-around prepare_read => sub {
+before prepare_read => sub {
     # Set the input handle to non-blocking
     *STDIN->blocking(0);
-    shift->(@_);
 };
 
 =head2 $self->read_chunk($c, $buffer, $length)




More information about the Catalyst-commits mailing list