Ripped out List::Util first() because it leaks memory
Andy Grundman [Wed, 26 Oct 2005 18:57:28 +0000 (18:57 +0000)]
Changes
Makefile.PL
lib/HTTP/Body.pm

diff --git a/Changes b/Changes
index 641f5a3..6aa531b 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,5 +1,9 @@
 This file documents the revision history for Perl extension HTTP::Body.
 
+0.0201
+        - removed use of List::Util first, which leaks memory!
+          http://rt.cpan.org/NoAuth/Bug.html?id=13891
+
 0.02  2005-10-07 00:00:00 2005
         - fixed POD
 
index 427d0db..781fbb4 100644 (file)
@@ -9,7 +9,6 @@ WriteMakefile(
         Carp         => 0,
         File::Temp   => '0.14',
         IO::File     => 0,
-        List::Util   => 0,
         YAML         => 0
     }
 );
index 12944df..cd6f8fd 100644 (file)
@@ -3,7 +3,6 @@ package HTTP::Body;
 use strict;
 
 use Carp       qw[ ];
-use List::Util qw[ first ];
 
 our $VERSION = '0.201';
 
@@ -66,7 +65,13 @@ sub new {
         Carp::croak( $class, '->new( $content_type, $content_length )' );
     }
 
-    my $type = first { index( lc($content_type), $_ ) >= 0 } keys %{$TYPES};
+    my $type;
+    foreach my $supported ( keys %{$TYPES} ) {
+        if ( index( lc($content_type), $supported ) >= 0 ) {
+            $type = $supported;
+        }
+    }
+
     my $body = $TYPES->{ $type || 'application/octet-stream' };
 
     eval "require $body";