From: Andy Grundman Date: Wed, 26 Oct 2005 18:57:28 +0000 (+0000) Subject: Ripped out List::Util first() because it leaks memory X-Git-Tag: v0.03~2 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=27ee4e942b6b29def8065a9f23c3b95aac0253f6;hp=71806b5ac85c8d87db0a4a3a03d98010d42db090;p=catagits%2FHTTP-Body.git Ripped out List::Util first() because it leaks memory --- diff --git a/Changes b/Changes index 641f5a3..6aa531b 100644 --- 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 diff --git a/Makefile.PL b/Makefile.PL index 427d0db..781fbb4 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -9,7 +9,6 @@ WriteMakefile( Carp => 0, File::Temp => '0.14', IO::File => 0, - List::Util => 0, YAML => 0 } ); diff --git a/lib/HTTP/Body.pm b/lib/HTTP/Body.pm index 12944df..cd6f8fd 100644 --- a/lib/HTTP/Body.pm +++ b/lib/HTTP/Body.pm @@ -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";